From ad4243b4fb562c2d5ccc7cc4e960d5e39b63ef00 Mon Sep 17 00:00:00 2001 From: "Pari Dhanani (pdhanani)" Date: Wed, 14 Jun 2023 15:23:31 +0530 Subject: [PATCH 001/248] test commit --- plugins/modules/dcnm_vrf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/modules/dcnm_vrf.py b/plugins/modules/dcnm_vrf.py index 3198a593c..2de37fbbc 100644 --- a/plugins/modules/dcnm_vrf.py +++ b/plugins/modules/dcnm_vrf.py @@ -13,6 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# random comment from __future__ import absolute_import, division, print_function __metaclass__ = type From 4cd53a5f78639925b02c80b08832d5b3ed096547 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:56:11 +0530 Subject: [PATCH 002/248] Add .circleci/config.yml --- .circleci/config.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..4175da6cf --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,26 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/configuration-reference +version: 2.1 + +# Define a job to be invoked later in a workflow. +# See: https://circleci.com/docs/configuration-reference/#jobs +jobs: + say-hello: + # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. + # See: https://circleci.com/docs/configuration-reference/#executor-job + docker: + - image: cimg/base:stable + # Add steps to the job + # See: https://circleci.com/docs/configuration-reference/#steps + steps: + - checkout + - run: + name: "Say hello" + command: "echo Hello, World!" + +# Orchestrate jobs using workflows +# See: https://circleci.com/docs/configuration-reference/#workflows +workflows: + say-hello-workflow: + jobs: + - say-hello From 70eafe7f168e7e8ccd1770faadf239aa39c3e732 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:57:44 +0530 Subject: [PATCH 003/248] Update main.yml --- .github/workflows/main.yml | 121 ------------------------------------- 1 file changed, 121 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3dd49e01..8b1378917 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,122 +1 @@ -# This is a basic workflow to help you get started with Actions -name: CI - -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the develop branch - push: - branches: [ develop, main ] - pull_request: - branches: [ develop, main ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build: - name: Build DCNM collection - runs-on: ubuntu-latest - strategy: - matrix: - ansible: [2.9.26, 2.10.17, 2.11.12, 2.12.10, 2.13.8, 2.14.2] - steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Set up Python 3.9 - uses: actions/setup-python@v1 - with: - python-version: 3.9 - - - 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: Build a DCNM collection tarball - run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/collection-tarballs" - - - name: Store migrated collection artifacts - uses: actions/upload-artifact@v1 - with: - name: collection - path: .cache/collection-tarballs - - - sanity: - name: Run ansible-sanity tests - needs: - - build - runs-on: ubuntu-latest - strategy: - matrix: - ansible: [2.9.26, 2.10.17, 2.11.12, 2.12.10, 2.13.8, 2.14.2] - python: [3.8, 3.9] - exclude: - - ansible: 2.9.26 - python: 3.9 - steps: - - name: Set up Python 3.9 - uses: actions/setup-python@v1 - with: - python-version: 3.9 - - - 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@v1 - with: - name: collection - path: .cache/collection-tarballs - - - name: Install the collection tarball - run: ansible-galaxy collection install .cache/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 - - - unit-tests: - name: Run DCNM Unit Tests - needs: - - build - runs-on: ubuntu-latest - strategy: - matrix: - ansible: [2.9.26, 2.10.17, 2.11.12, 2.12.10, 2.13.8, 2.14.2] - steps: - - name: Set up Python 3.9 - uses: actions/setup-python@v1 - with: - python-version: 3.9 - - - 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 coverage (v4.5.4) - run: pip install coverage==4.5.4 - - - name: Install pytest (v5.4.1) - run: pip install pytest==5.4.1 - - - name: Download migrated collection artifacts - uses: actions/download-artifact@v1 - with: - name: collection - path: .cache/collection-tarballs - - - name: Install the collection tarball - run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz - - - name: Run DCNM Unit tests - run: coverage run --source=. -m pytest tests/unit/modules/dcnm/. -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 From 37e8e8358b7d76215fd3c73b7f65dabf2dfcde73 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 14 Jun 2023 20:00:41 +0530 Subject: [PATCH 004/248] Update config.yml --- .circleci/config.yml | 119 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 101 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4175da6cf..56aa9a128 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,26 +1,109 @@ -# Use the latest 2.1 version of CircleCI pipeline process engine. -# See: https://circleci.com/docs/configuration-reference version: 2.1 -# Define a job to be invoked later in a workflow. -# See: https://circleci.com/docs/configuration-reference/#jobs jobs: - say-hello: - # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. - # See: https://circleci.com/docs/configuration-reference/#executor-job + build: + working_directory: ~/repo + + docker: + - image: circleci/python:3.9 + + steps: + - checkout + + - setup_remote_docker: + version: 20.10.7 + + - run: + name: Set up Python 3.9 + command: | + sudo apt-get update + sudo apt-get install -y python3.9 + + - run: + name: Install ansible-base (v${{ matrix.ansible }}) + command: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + - run: + name: Build a DCNM collection tarball + command: ansible-galaxy collection build --output-path "${HOME}/.cache/collection-tarballs" + + - store_artifacts: + path: ~/.cache/collection-tarballs + destination: collection + + sanity: + working_directory: ~/repo + docker: + - image: circleci/python:3.9 + + steps: + - checkout + + - setup_remote_docker: + version: 20.10.7 + + - run: + name: Set up Python 3.9 + command: | + sudo apt-get update + sudo apt-get install -y python3.9 + + - run: + name: Install ansible-base (v${{ matrix.ansible }}) + command: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + - run: + name: Download migrated collection artifacts + command: circleci step download_artifacts -n collection + + - run: + name: Install the collection tarball + command: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz + + - run: + name: Run sanity tests + command: ansible-test sanity --docker --python ${{matrix.python}} -v --color --truncate 0 + environment: + PYTHONPATH: /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm + + unit-tests: + working_directory: ~/repo docker: - - image: cimg/base:stable - # Add steps to the job - # See: https://circleci.com/docs/configuration-reference/#steps + - image: circleci/python:3.9 + steps: - checkout + + - setup_remote_docker: + version: 20.10.7 + - run: - name: "Say hello" - command: "echo Hello, World!" + name: Set up Python 3.9 + command: | + sudo apt-get update + sudo apt-get install -y python3.9 -# Orchestrate jobs using workflows -# See: https://circleci.com/docs/configuration-reference/#workflows -workflows: - say-hello-workflow: - jobs: - - say-hello + - run: + name: Install ansible-base (v${{ matrix.ansible }}) + command: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + - run: + name: Install coverage (v4.5.4) + command: pip install coverage==4.5.4 + + - run: + name: Install pytest (v5.4.1) + command: pip install pytest==5.4.1 + + - run: + name: Download migrated collection artifacts + command: circleci step download_artifacts -n collection + + - run: + name: Install the collection tarball + command: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz + + - run: + name: Run DCNM Unit tests + command: | + coverage run --source=. -m pytest tests/unit/modules/dcnm/. From 718acd2a2e4614ad57d00192ba78fee0ce50d528 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 14 Jun 2023 20:07:14 +0530 Subject: [PATCH 005/248] Updated config.yml --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 56aa9a128..30747265a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ jobs: working_directory: ~/repo docker: - - image: circleci/python:3.9 + - image: cimg/base:stable steps: - checkout @@ -34,7 +34,7 @@ jobs: sanity: working_directory: ~/repo docker: - - image: circleci/python:3.9 + - image: cimg/base:stable steps: - checkout @@ -69,7 +69,7 @@ jobs: unit-tests: working_directory: ~/repo docker: - - image: circleci/python:3.9 + - image: cimg/base:stable steps: - checkout From 902ea187a7e3b4a5b64ebffa6dfbbb8c1c20032b Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 15 Jun 2023 11:19:25 +0530 Subject: [PATCH 006/248] Updated config.yml --- .circleci/config.yml | 82 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 71 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 30747265a..daf630b9b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,10 +2,14 @@ version: 2.1 jobs: build: + parameters: + ansible_version: + type: string + working_directory: ~/repo docker: - - image: cimg/base:stable + - image: circleci/python:3.9 steps: - checkout @@ -18,10 +22,10 @@ jobs: command: | sudo apt-get update sudo apt-get install -y python3.9 - + - run: - name: Install ansible-base (v${{ matrix.ansible }}) - command: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check + name: Install ansible-base (v<< parameters.ansible_version >> + command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >> .tar.gz --disable-pip-version-check - run: name: Build a DCNM collection tarball @@ -32,9 +36,15 @@ jobs: destination: collection sanity: + parameters: + ansible_version: + type: string + py_version: + type: string + working_directory: ~/repo docker: - - image: cimg/base:stable + - image: circleci/python:3.9 steps: - checkout @@ -49,8 +59,8 @@ jobs: sudo apt-get install -y python3.9 - run: - name: Install ansible-base (v${{ matrix.ansible }}) - command: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check + name: Install ansible-base (v<< parameters.ansible_version >> + command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - run: name: Download migrated collection artifacts @@ -62,14 +72,19 @@ jobs: - run: name: Run sanity tests - command: ansible-test sanity --docker --python ${{matrix.python}} -v --color --truncate 0 + command: ansible-test sanity --docker --python << parameters.py_version >> -v --color --truncate 0 environment: PYTHONPATH: /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm unit-tests: + parameters: + ansible_version: + type: string + + working_directory: ~/repo docker: - - image: cimg/base:stable + - image: circleci/python:3.9 steps: - checkout @@ -84,8 +99,8 @@ jobs: sudo apt-get install -y python3.9 - run: - name: Install ansible-base (v${{ matrix.ansible }}) - command: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check + name: Install ansible-base (v<< parameters.ansible_version >>) + command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - run: name: Install coverage (v4.5.4) @@ -107,3 +122,48 @@ jobs: name: Run DCNM Unit tests command: | coverage run --source=. -m pytest tests/unit/modules/dcnm/. + +workflows: + build-test-and-deploy: + jobs: + - build: + matrix: + parameters: + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + + - sanity: + requires: + - build + matrix: + parameters: + py_version: + - "3.8" + - "3.9" + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + + - unit-tests: + requires: + - build + matrix: + parameters: + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + + From e8bdd918377a696658dc17e08f0697d34067e2cb Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 15 Jun 2023 11:23:11 +0530 Subject: [PATCH 007/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index daf630b9b..3a10d5f17 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,7 +25,7 @@ jobs: - run: name: Install ansible-base (v<< parameters.ansible_version >> - command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >> .tar.gz --disable-pip-version-check + command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - run: name: Build a DCNM collection tarball From 7d6a1d9a65dc379e38674bda5274126e242869f5 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 15 Jun 2023 12:18:46 +0530 Subject: [PATCH 008/248] Updated config.yml --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3a10d5f17..ecbe767df 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -64,7 +64,7 @@ jobs: - run: name: Download migrated collection artifacts - command: circleci step download_artifacts -n collection + command: curl -H "Circle-Token cf55185a5334438422f9e9157a1b435efdc8faae" https://circleci.com/api/v1.1/project/github/Pari-Dhanani/ansible-dcnm/latest/artifacts - run: name: Install the collection tarball @@ -112,7 +112,7 @@ jobs: - run: name: Download migrated collection artifacts - command: circleci step download_artifacts -n collection + command: curl -H "Circle-Token cf55185a5334438422f9e9157a1b435efdc8faae" https://circleci.com/api/v1.1/project/github/Pari-Dhanani/ansible-dcnm/latest/artifacts - run: name: Install the collection tarball From 0b7ab8dac5dc2ce54069552a2acb9f16b19397b1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 15 Jun 2023 12:38:34 +0530 Subject: [PATCH 009/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ecbe767df..63d23c72c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -64,7 +64,7 @@ jobs: - run: name: Download migrated collection artifacts - command: curl -H "Circle-Token cf55185a5334438422f9e9157a1b435efdc8faae" https://circleci.com/api/v1.1/project/github/Pari-Dhanani/ansible-dcnm/latest/artifacts + command: https://output.circle-artifacts.com/output/job/8bd42882-4c5f-49c5-a47a-0b94b1c19a63/artifacts/0/collection/cisco-dcnm-3.3.0.tar.gz - run: name: Install the collection tarball From b8210e5c8f7f1942a8417a17f361262e60b6242c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 15 Jun 2023 15:15:56 +0530 Subject: [PATCH 010/248] Updated config.yml --- .circleci/config.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 63d23c72c..ea394d56f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,9 +31,17 @@ jobs: name: Build a DCNM collection tarball command: ansible-galaxy collection build --output-path "${HOME}/.cache/collection-tarballs" + - run: + name: print home directory + command: echo ${HOME} + - store_artifacts: path: ~/.cache/collection-tarballs - destination: collection + destination: collection + + - run: + name: print artifact path + command: echo ~/.cache/collection-tarballs sanity: parameters: From 1ab57b916d0bbb6447e3dd938101461a99c3eda8 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 15 Jun 2023 15:32:01 +0530 Subject: [PATCH 011/248] Updated config.yml --- .circleci/config.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ea394d56f..a4144a343 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,11 +37,15 @@ jobs: - store_artifacts: path: ~/.cache/collection-tarballs - destination: collection + destination: collection - run: name: print artifact path - command: echo ~/.cache/collection-tarballs + command: echo ~/.cache/collection-tarballs + + - run: + name: print path + command: ls -lrt /home/circleci/.cache/collection-tarballs/cisco-dcnm-3.3.0.tar.gz sanity: parameters: @@ -69,11 +73,15 @@ jobs: - run: name: Install ansible-base (v<< parameters.ansible_version >> command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - + - run: + name: print path + command: ls -lrt /home/circleci/.cache/collection-tarballs/ + + - run: + command: curl -H "Circle-Token cf55185a5334438422f9e9157a1b435efdc8faae " https://circleci.com/api/v1.1/project/github/Pari-Dhanani/ansible-dcnm/latest/artifacts name: Download migrated collection artifacts - command: https://output.circle-artifacts.com/output/job/8bd42882-4c5f-49c5-a47a-0b94b1c19a63/artifacts/0/collection/cisco-dcnm-3.3.0.tar.gz - + - run: name: Install the collection tarball command: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz From ceb3ceca7900070077b13e16a1a45bd5bd7d03e1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 15 Jun 2023 15:41:11 +0530 Subject: [PATCH 012/248] Updated config.yml --- .circleci/config.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a4144a343..3a574f6b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -75,11 +75,7 @@ jobs: command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - run: - name: print path - command: ls -lrt /home/circleci/.cache/collection-tarballs/ - - - run: - command: curl -H "Circle-Token cf55185a5334438422f9e9157a1b435efdc8faae " https://circleci.com/api/v1.1/project/github/Pari-Dhanani/ansible-dcnm/latest/artifacts + command: curl -H "Circle-Token:cf55185a5334438422f9e9157a1b435efdc8faae" https://circleci.com/api/v1.1/project/github/Pari-Dhanani/ansible-dcnm/latest/artifacts name: Download migrated collection artifacts - run: From b5b24b1a87081c5b1d8b6b2b717770c173e47117 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 15 Jun 2023 15:48:27 +0530 Subject: [PATCH 013/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3a574f6b6..43665b763 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -80,7 +80,7 @@ jobs: - run: name: Install the collection tarball - command: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz + command: ansible-galaxy collection install collection/*.tar.gz - run: name: Run sanity tests From d70af72609668f0796dc847987f8074786319f40 Mon Sep 17 00:00:00 2001 From: praveenramoorthy <62758226+praveenramoorthy@users.noreply.github.com> Date: Thu, 15 Jun 2023 19:16:12 +0530 Subject: [PATCH 014/248] Fix default mcast group address in network module (#224) * Fix default mcast group address in network module * IT case for network creation in ingress multiplication enabled fabric * IT case for network creation in ingress multiplication enabled fabric --- plugins/modules/dcnm_network.py | 15 +- .../ingress_replication_networks.yaml | 134 ++++++++++++++++++ 2 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/ingress_replication_networks.yaml diff --git a/plugins/modules/dcnm_network.py b/plugins/modules/dcnm_network.py index 6c33c50aa..5a9649118 100644 --- a/plugins/modules/dcnm_network.py +++ b/plugins/modules/dcnm_network.py @@ -2453,7 +2453,12 @@ def validate_input(self): if state == "query": - if self.dcnm_version > 11: + # If ingress replication is enabled multicast group address should be set to "" as default. + # If ingress replication is not enabled, the default value for multicast group address + # is different for DCNM and NDFC. + if self.fabric_det.get("replicationMode") == "Ingress": + mcast_group_addr = "" + elif self.dcnm_version > 11: mcast_group_addr = "239.1.1.1" else: mcast_group_addr = "239.1.1.0" @@ -2533,8 +2538,12 @@ def validate_input(self): else: - # The default value for multicast group address is different for DCNM and NDFC. - if self.dcnm_version > 11: + # If ingress replication is enabled multicast group address should be set to "" as default. + # If ingress replication is not enabled, the default value for multicast group address + # is different for DCNM and NDFC. + if self.fabric_det.get("replicationMode") == "Ingress": + mcast_group_addr = "" + elif self.dcnm_version > 11: mcast_group_addr = "239.1.1.1" else: mcast_group_addr = "239.1.1.0" 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 new file mode 100644 index 000000000..334decde9 --- /dev/null +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/ingress_replication_networks.yaml @@ -0,0 +1,134 @@ +############################################## +## SETUP ## +############################################## +- block: + - 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" + + - 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' + + - 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 + +############################################## +## 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: 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"' + + - 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: 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"' + +############################################## +## CLEAN-UP ## +############################################## + + - name: MERGED - setup - remove any networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: deleted + when: test_ing_fabric is defined From ce25908d1b346db248a6b80614e421fbc635d371 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:32:36 +0530 Subject: [PATCH 015/248] Updated config.yml --- .circleci/config.yml | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 43665b763..3a7a1e196 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,25 +27,6 @@ jobs: name: Install ansible-base (v<< parameters.ansible_version >> command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - - run: - name: Build a DCNM collection tarball - command: ansible-galaxy collection build --output-path "${HOME}/.cache/collection-tarballs" - - - run: - name: print home directory - command: echo ${HOME} - - - store_artifacts: - path: ~/.cache/collection-tarballs - destination: collection - - - run: - name: print artifact path - command: echo ~/.cache/collection-tarballs - - - run: - name: print path - command: ls -lrt /home/circleci/.cache/collection-tarballs/cisco-dcnm-3.3.0.tar.gz sanity: parameters: @@ -73,14 +54,10 @@ jobs: - run: name: Install ansible-base (v<< parameters.ansible_version >> command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - - - run: - command: curl -H "Circle-Token:cf55185a5334438422f9e9157a1b435efdc8faae" https://circleci.com/api/v1.1/project/github/Pari-Dhanani/ansible-dcnm/latest/artifacts - name: Download migrated collection artifacts - run: name: Install the collection tarball - command: ansible-galaxy collection install collection/*.tar.gz + command: ansible-galaxy collection install cisco.dcnm - run: name: Run sanity tests @@ -121,14 +98,10 @@ jobs: - run: name: Install pytest (v5.4.1) command: pip install pytest==5.4.1 - - - run: - name: Download migrated collection artifacts - command: curl -H "Circle-Token cf55185a5334438422f9e9157a1b435efdc8faae" https://circleci.com/api/v1.1/project/github/Pari-Dhanani/ansible-dcnm/latest/artifacts - + - run: name: Install the collection tarball - command: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz + command: ansible-galaxy collection install cisco.dcnm - run: name: Run DCNM Unit tests From 32354d10ac974226b11664dd812f1bd196325e81 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:54:20 +0530 Subject: [PATCH 016/248] Updated config.yml --- .circleci/config.yml | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3a7a1e196..ae4606d79 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,7 @@ jobs: py_version: type: string - working_directory: ~/repo + working_directory: home/circleci/.ansible/collections docker: - image: circleci/python:3.9 @@ -71,7 +71,7 @@ jobs: type: string - working_directory: ~/repo + working_directory: home/circleci/.ansible/collections docker: - image: circleci/python:3.9 @@ -115,12 +115,9 @@ workflows: matrix: parameters: ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + - sanity: requires: @@ -131,12 +128,9 @@ workflows: - "3.8" - "3.9" ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + - unit-tests: requires: @@ -144,11 +138,7 @@ workflows: matrix: parameters: ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 - + From de718092798f46c0cf6a803bc7f6d2cf784812d1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:58:47 +0530 Subject: [PATCH 017/248] Updated config.yml --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ae4606d79..1105dd9a9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,7 @@ jobs: py_version: type: string - working_directory: home/circleci/.ansible/collections + working_directory: ~/repo docker: - image: circleci/python:3.9 @@ -63,7 +63,7 @@ jobs: name: Run sanity tests command: ansible-test sanity --docker --python << parameters.py_version >> -v --color --truncate 0 environment: - PYTHONPATH: /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm + PYTHONPATH: /home/circleci/.ansible/collections unit-tests: parameters: @@ -71,7 +71,7 @@ jobs: type: string - working_directory: home/circleci/.ansible/collections + working_directory: ~/repo docker: - image: circleci/python:3.9 From 36f587da3d30bc9340c437449e60bf48ea639b61 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 15:08:06 +0530 Subject: [PATCH 018/248] Updated config.yml --- .circleci/config.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1105dd9a9..e1bd43c0a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,6 +59,10 @@ jobs: name: Install the collection tarball command: ansible-galaxy collection install cisco.dcnm + - run: + name: change directory + command: cd /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm + - run: name: Run sanity tests command: ansible-test sanity --docker --python << parameters.py_version >> -v --color --truncate 0 @@ -102,7 +106,9 @@ jobs: - run: name: Install the collection tarball command: ansible-galaxy collection install cisco.dcnm - + - run: + name: change directory + command: cd /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm - run: name: Run DCNM Unit tests command: | From b27609faeb696cf9ae9658426ab28b585439d3da Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 15:13:29 +0530 Subject: [PATCH 019/248] Updated config.yml --- .circleci/config.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1bd43c0a..992c3b7d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,16 +16,10 @@ jobs: - setup_remote_docker: version: 20.10.7 - - - run: - name: Set up Python 3.9 - command: | - sudo apt-get update - sudo apt-get install -y python3.9 - run: - name: Install ansible-base (v<< parameters.ansible_version >> - command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check + name: Installed (v<< parameters.ansible_version >>) + command: echo install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check sanity: @@ -61,7 +55,9 @@ jobs: - run: name: change directory - command: cd /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm + command: | + cd .. + cd .ansible/collections/ansible_collections/cisco/dcnm/ - run: name: Run sanity tests @@ -108,7 +104,10 @@ jobs: command: ansible-galaxy collection install cisco.dcnm - run: name: change directory - command: cd /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm + command: | + cd .. + cd .ansible/collections/ansible_collections/cisco/dcnm/ + - run: name: Run DCNM Unit tests command: | From 4dce96c6f207f146aa1cb12b1c88c1af674fb6c3 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 15:15:35 +0530 Subject: [PATCH 020/248] Updated config.yml --- .circleci/config.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 992c3b7d9..b4628375f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,8 +56,10 @@ jobs: - run: name: change directory command: | + pwd cd .. - cd .ansible/collections/ansible_collections/cisco/dcnm/ + cd .ansible/collections/ansible_collections/cisco/dcnm/ + pwd - run: name: Run sanity tests @@ -105,8 +107,10 @@ jobs: - run: name: change directory command: | + pwd cd .. cd .ansible/collections/ansible_collections/cisco/dcnm/ + pwd - run: name: Run DCNM Unit tests From 9bee14c2d030f41a5aab3264de92a69fa64f63cf Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 15:18:43 +0530 Subject: [PATCH 021/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b4628375f..bafb350b9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -109,7 +109,7 @@ jobs: command: | pwd cd .. - cd .ansible/collections/ansible_collections/cisco/dcnm/ + cd .ansible/collections/ pwd - run: From d66a8ec29fbbc4f180d1e315314f89453fd8fe9b Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 15:21:33 +0530 Subject: [PATCH 022/248] Updated config.yml --- .circleci/config.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bafb350b9..032dcef0f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,18 +52,16 @@ jobs: - run: name: Install the collection tarball command: ansible-galaxy collection install cisco.dcnm + - run: - name: change directory + name: Run sanity tests command: | pwd cd .. cd .ansible/collections/ansible_collections/cisco/dcnm/ - pwd - - - run: - name: Run sanity tests - command: ansible-test sanity --docker --python << parameters.py_version >> -v --color --truncate 0 + pwd + ansible-test sanity --docker --python << parameters.py_version >> -v --color --truncate 0 environment: PYTHONPATH: /home/circleci/.ansible/collections From 28c1e418c64fda2c8e81c1f4a0d37cddba8d7159 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 16:22:24 +0530 Subject: [PATCH 023/248] Updated config.yml --- .circleci/config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 032dcef0f..a70d125a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -113,6 +113,11 @@ jobs: - run: name: Run DCNM Unit tests command: | + pwd + cd .. + cd .ansible/collections/ + pwd + env coverage run --source=. -m pytest tests/unit/modules/dcnm/. workflows: From bc82b673bccc1d8578166269d367c2a87fc7fd1d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 16:27:09 +0530 Subject: [PATCH 024/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a70d125a6..1e0048b22 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -107,7 +107,7 @@ jobs: command: | pwd cd .. - cd .ansible/collections/ + cd .ansible/collections/ansible_collections/cisco/dcnm/ pwd - run: From 03f112bc0623043d922328f00f1d6c2e6d006bcf Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 16:27:29 +0530 Subject: [PATCH 025/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1e0048b22..ae37b56a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -115,7 +115,7 @@ jobs: command: | pwd cd .. - cd .ansible/collections/ + cd .ansible/ansible_collections/cisco/dcnm/ pwd env coverage run --source=. -m pytest tests/unit/modules/dcnm/. From b6996f1b3a1798fea3176f67cec2011b20ac4e10 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 16:28:54 +0530 Subject: [PATCH 026/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ae37b56a6..a8d8b853e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -115,7 +115,7 @@ jobs: command: | pwd cd .. - cd .ansible/ansible_collections/cisco/dcnm/ + cd .ansible/collections/ansible_collections/cisco/dcnm/ pwd env coverage run --source=. -m pytest tests/unit/modules/dcnm/. From 27a59a2a36679fd747308ccdc456d993a3c287e5 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 19 Jun 2023 22:29:18 +0530 Subject: [PATCH 027/248] Updated config.yml --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a8d8b853e..f7dfd5cc4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -112,12 +112,13 @@ jobs: - run: name: Run DCNM Unit tests + environment: + PYTHONPATH: /home/runner/.ansible/collections command: | pwd cd .. cd .ansible/collections/ansible_collections/cisco/dcnm/ pwd - env coverage run --source=. -m pytest tests/unit/modules/dcnm/. workflows: From 9701da024eb6cc1b22cf156d451af9e66088aff3 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 20 Jun 2023 18:51:33 +0530 Subject: [PATCH 028/248] Update dcnm_interface.py --- plugins/action/dcnm_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/action/dcnm_interface.py b/plugins/action/dcnm_interface.py index 09145428f..3bb393e73 100644 --- a/plugins/action/dcnm_interface.py +++ b/plugins/action/dcnm_interface.py @@ -10,7 +10,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# other limitations under the License. from __future__ import absolute_import, division, print_function From 6d3a39cf4a9115c97cd701b331858689bf8919e7 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 20 Jun 2023 18:52:10 +0530 Subject: [PATCH 029/248] Update dcnm_interface.py --- plugins/action/dcnm_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/action/dcnm_interface.py b/plugins/action/dcnm_interface.py index 3bb393e73..09145428f 100644 --- a/plugins/action/dcnm_interface.py +++ b/plugins/action/dcnm_interface.py @@ -10,7 +10,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# other limitations under the License. +# limitations under the License. from __future__ import absolute_import, division, print_function From 74c218dcd6189b941805a08dc218ec4eaadbdbbe Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:31:36 +0530 Subject: [PATCH 030/248] Update dcnm_service_policy.py --- plugins/modules/dcnm_service_policy.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/modules/dcnm_service_policy.py b/plugins/modules/dcnm_service_policy.py index 0b4a21b2c..31308eddd 100644 --- a/plugins/modules/dcnm_service_policy.py +++ b/plugins/modules/dcnm_service_policy.py @@ -1,11 +1,9 @@ #!/usr/bin/python -# # Copyright (c) 2021-2023 Cisco and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software From efc3d0cc11624cca8ea20c6616bd174f3a2c6da8 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:32:03 +0530 Subject: [PATCH 031/248] Update dcnm_network.py --- plugins/modules/dcnm_network.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/modules/dcnm_network.py b/plugins/modules/dcnm_network.py index 6c33c50aa..8518052ac 100644 --- a/plugins/modules/dcnm_network.py +++ b/plugins/modules/dcnm_network.py @@ -1,11 +1,9 @@ #!/usr/bin/python -# # Copyright (c) 2020-2023 Cisco and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software From fb9a40a27886351091e5aaa57a0e7f4b7721206b Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:37:38 +0530 Subject: [PATCH 032/248] Update dcnm_inventory.py --- plugins/action/dcnm_inventory.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/action/dcnm_inventory.py b/plugins/action/dcnm_inventory.py index a6c2e0ac5..88bc872e4 100644 --- a/plugins/action/dcnm_inventory.py +++ b/plugins/action/dcnm_inventory.py @@ -1,9 +1,7 @@ # Copyright (c) 2020-2022 Cisco and/or its affiliates. -# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software From dc3acb747404901d86d3a26221b2609aedcfb631 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:43:14 +0530 Subject: [PATCH 033/248] Updated config.yml --- .circleci/config.yml | 487 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 433 insertions(+), 54 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f7dfd5cc4..778a2f6eb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,5 +1,58 @@ version: 2.1 +setup: << pipeline.parameters.run-setup >> + +orbs: + path-filtering: circleci/path-filtering@0.1.6 + + +parameters: + run-setup: + type: boolean + default: false + run-inventory: + type: boolean + default: false + run-interface: + type: boolean + default: false + run-links: + type: boolean + default: false + run-network: + type: boolean + default: false + run-policy: + type: boolean + default: false + run-resource_manager: + type: boolean + default: false + run-rest: + type: boolean + default: false + run-service_node: + type: boolean + default: false + run-service_policy: + type: boolean + default: false + run-service_route_peering: + type: boolean + default: false + run-template: + type: boolean + default: false + run-vrf: + type: boolean + default: false + run-all-unit: + type: boolean + default: false + run-all: + type: boolean + default: false + jobs: build: parameters: @@ -7,31 +60,48 @@ jobs: type: string working_directory: ~/repo - - docker: - - image: circleci/python:3.9 + machine: true + resource_class: cisco/ansible-dcnm steps: - checkout - - setup_remote_docker: - version: 20.10.7 + - run: + name: Set up Python 3.9 + command: | + sudo apt-get update + sudo apt-get install -y python3.9 - run: - name: Installed (v<< parameters.ansible_version >>) - command: echo install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check + name: Install ansible-base (v<< parameters.ansible_version >> + command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check + + - run: + name: Install DCNM collection + command: ansible-galaxy collection install cisco.dcnm + + - run: + name: Install coverage (v4.5.4) + command: pip install coverage==4.5.4 + + - run: + name: Install pytest (v5.4.1) + command: pip install pytest==5.4.1 + - run: + name: Build a DCNM collection tarball + command: ansible-galaxy collection build --output-path "${HOME}/.cache/collection-tarballs" sanity: parameters: ansible_version: type: string - py_version: + modulename: type: string working_directory: ~/repo - docker: - - image: circleci/python:3.9 + machine: true + resource_class: cisco/ansible-dcnm steps: - checkout @@ -46,24 +116,34 @@ jobs: sudo apt-get install -y python3.9 - run: - name: Install ansible-base (v<< parameters.ansible_version >> + name: Install ansible-base (v<< parameters.ansible_version >>) command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check + - run: name: Install the collection tarball - command: ansible-galaxy collection install cisco.dcnm - + command: ansible-galaxy collection install ${HOME}/.cache/collection-tarballs/*.tar.gz - run: - name: Run sanity tests + name: Run DCNM Unit tests for << parameters.modulename >> command: | - pwd - cd .. - cd .ansible/collections/ansible_collections/cisco/dcnm/ - pwd - ansible-test sanity --docker --python << parameters.py_version >> -v --color --truncate 0 - environment: - PYTHONPATH: /home/circleci/.ansible/collections + coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py + + - run: + name: Run sanity tests py 3.8 for << parameters.modulename >> + command: echo done + # command: ansible-test sanity --python 3.8 -v --color --truncate 0 + # environment: + # PYTHONPATH: /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm + + - run: + name: Run sanity tests py 3.9 for << parameters.modulename >> + command: echo done + # command: ansible-test sanity --python 3.9 -v --color --truncate 0 + # environment: + # PYTHONPATH: /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm + + unit-tests: parameters: @@ -72,15 +152,12 @@ jobs: working_directory: ~/repo - docker: - - image: circleci/python:3.9 + machine: true + resource_class: cisco/ansible-dcnm steps: - checkout - - setup_remote_docker: - version: 20.10.7 - - run: name: Set up Python 3.9 command: | @@ -91,67 +168,369 @@ jobs: name: Install ansible-base (v<< parameters.ansible_version >>) command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - - run: - name: Install coverage (v4.5.4) - command: pip install coverage==4.5.4 - - run: - name: Install pytest (v5.4.1) - command: pip install pytest==5.4.1 - - run: name: Install the collection tarball - command: ansible-galaxy collection install cisco.dcnm - - run: - name: change directory - command: | - pwd - cd .. - cd .ansible/collections/ansible_collections/cisco/dcnm/ - pwd + command: ansible-galaxy collection install ${HOME}/.cache/collection-tarballs/*.tar.gz - run: name: Run DCNM Unit tests - environment: - PYTHONPATH: /home/runner/.ansible/collections command: | - pwd - cd .. - cd .ansible/collections/ansible_collections/cisco/dcnm/ - pwd coverage run --source=. -m pytest tests/unit/modules/dcnm/. + + + workflows: - build-test-and-deploy: + pre: + when: << pipeline.parameters.run-setup >> jobs: + - build: matrix: parameters: ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 - 2.12.10 - 2.13.8 + - 2.14.2 + + - path-filtering/filter: + requires: + - build + # Compare files on develop + base-revision: develop + # Config for continuation; herein we reuse this config itself + config-path: .circleci/config.yml + # 3-column space-separated table for mapping; `path-to-test parameter-to-set value-for-parameter` for each row + mapping: | + .* run-setup false + plugins/httpapi/.* run-all true + plugins/module_utils/.* run-all true + plugins/action/dcnm_interface.py run-interface true + plugins/action/dcnm_inventory.py run-inventory true + plugins/action/dcnm_vrf.py run-vrf true + plugins/modules/dcnm_inventory.py run-inventory true + plugins/modules/dcnm_interface.py run-interface true + plugins/modules/dcnm_links.py run-links true + plugins/modules/dcnm_network.py run-network true + plugins/modules/dcnm_policy.py run-policy true + plugins/modules/dcnm_resource_manager.py run-resource_manager true + plugins/modules/dcnm_rest.py run-rest true + plugins/modules/dcnm_service_node.py run-service_node true + plugins/modules/dcnm_service_policy.py run-service_policy true + plugins/modules/dcnm_service_route_peering.py run-service_route_peering true + plugins/modules/dcnm_template.py run-template true + plugins/modules/dcnm_vrf.py run-vrf true + + tests/unit/modules/dcnm run-all-unit true + + tests/integration/targets/dcnm_inventory/.* run-inventory true + tests/integration/targets/dcnm_interface/.* run-interface true + tests/integration/targets/dcnm_links/.* run-links true + tests/integration/targets/dcnm_network/.* run-network true + tests/integration/targets/dcnm_policy/.* run-policy true + tests/integration/targets/dcnm_resource_manager/.* run-resource_manager true + tests/integration/targets/dcnm_fabric/.* run-all true + tests/integration/targets/dcnm_service_node/.* run-service_node true + tests/integration/targets/dcnm_service_policy/.* run-service_policy true + tests/integration/targets/dcnm_service_route_peering/.* run-service_route_peering true + tests/integration/targets/dcnm_template/.* run-template true + tests/integration/targets/dcnm_vrf/.* run-vrf true + tests/integration/targets/prepare_dcnm_intf/tasks/.* run-all true + tests/integration/targets/prepare_dcnm_links/tasks/.* run-links true + tests/integration/targets/prepare_dcnm_policy/tasks/.* run-policy true + tests/integration/targets/prepare_dcnm_service_policy/tasks/.* run-service_policy true + tests/integration/targets/prepare_dcnm_service_route_peering/tasks/.* run-service_route_peering true + tests/integration/targets/prepare_dcnm_template/tasks/.* run-template true + + + # module-a/.* run-module-a true + # module-b/.* run-module-b true + + all-unit: + when: + # or: + # - << pipeline.parameters.run-all >> + << pipeline.parameters.run-all-unit >> + jobs: + - unit-tests: + requires: + - build + matrix: + parameters: + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + + - + interface: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-interface >> + jobs: - sanity: requires: - build matrix: parameters: - py_version: - - "3.8" - - "3.9" + + modulename: + - interface ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 - 2.12.10 - 2.13.8 + - 2.14.2 + # - interface_job + inventory: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-inventory >> + jobs: + - sanity: + requires: + - build + matrix: + parameters: - - - unit-tests: + modulename: + - inventory + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + # - inventory_job + vrf: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-vrf >> + jobs: + - sanity: + requires: + - build + matrix: + parameters: + + modulename: + - vrf + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + links: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-links >> + jobs: + - sanity: + requires: + - build + matrix: + parameters: + + modulename: + - links + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + network: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-network >> + jobs: + - sanity: + requires: + - build + matrix: + parameters: + + modulename: + - network + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + policy: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-policy >> + jobs: + - sanity: + requires: + - build + matrix: + parameters: + + modulename: + - policy + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + + resource_manager: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-resource_manager >> + jobs: + - sanity: + requires: + - build + matrix: + parameters: + + modulename: + - resource_manager + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + + service_node: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-service_node >> + jobs: + - sanity: requires: - build matrix: parameters: + + modulename: + - service_node + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + + service_policy: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-service_policy >> + jobs: + - sanity: + requires: + - build + matrix: + parameters: + + modulename: + - service_policy_job + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + + + service_route_peering: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-service_route_peering >> + jobs: + - sanity: + requires: + - build + matrix: + parameters: + + modulename: + - service_route_peering + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + + template: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-template >> + jobs: + - sanity: + requires: + - build + matrix: + parameters: + + modulename: + - template ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 - 2.12.10 - 2.13.8 + - 2.14.2 + + rest: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-rest >> + jobs: + - sanity: + requires: + - build + matrix: + parameters: + modulename: + - rest + ansible_version: + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 + - 2.13.8 + - 2.14.2 + From bf3717fcce49f849f6eff69f66081776552790a1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:45:08 +0530 Subject: [PATCH 034/248] Updated config.yml --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 778a2f6eb..f0590f809 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,7 +65,6 @@ jobs: steps: - checkout - - run: name: Set up Python 3.9 command: | From 4541226b8dc59f7ea6a4c80a9172408c462fe359 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:46:34 +0530 Subject: [PATCH 035/248] Updated config.yml --- .circleci/config.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f0590f809..9987bd386 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,7 +9,7 @@ orbs: parameters: run-setup: type: boolean - default: false + default: true run-inventory: type: boolean default: false @@ -178,8 +178,6 @@ jobs: coverage run --source=. -m pytest tests/unit/modules/dcnm/. - - workflows: pre: when: << pipeline.parameters.run-setup >> From e8d2679a29426e9fa18f13df7af4f06bf20d51e7 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:52:37 +0530 Subject: [PATCH 036/248] Updated config.yml --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9987bd386..8bc6a78b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,7 +72,7 @@ jobs: sudo apt-get install -y python3.9 - run: - name: Install ansible-base (v<< parameters.ansible_version >> + name: Install ansible-base (v<< parameters.ansible_version >>) command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - run: @@ -89,7 +89,7 @@ jobs: - run: name: Build a DCNM collection tarball - command: ansible-galaxy collection build --output-path "${HOME}/.cache/collection-tarballs" + command: ansible-galaxy collection build --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" sanity: parameters: @@ -121,7 +121,7 @@ jobs: - run: name: Install the collection tarball - command: ansible-galaxy collection install ${HOME}/.cache/collection-tarballs/*.tar.gz + command: ansible-galaxy collection install ${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs/*.tar.gz - run: name: Run DCNM Unit tests for << parameters.modulename >> @@ -170,7 +170,7 @@ jobs: - run: name: Install the collection tarball - command: ansible-galaxy collection install ${HOME}/.cache/collection-tarballs/*.tar.gz + command: ansible-galaxy collection install ${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs/*.tar.gz - run: name: Run DCNM Unit tests From a28367beb8dd0cb75c557098a84cf505e94d020a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 23 Jun 2023 08:58:09 +0530 Subject: [PATCH 037/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8bc6a78b4..602a1bd54 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -73,7 +73,7 @@ jobs: - run: name: Install ansible-base (v<< parameters.ansible_version >>) - command: pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check + command: python 3.9 -m pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - run: name: Install DCNM collection From 523c733da61a4ba9248d4fa51fe7d52ac84dcff5 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 23 Jun 2023 09:04:40 +0530 Subject: [PATCH 038/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 602a1bd54..9d9e22adb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -73,7 +73,7 @@ jobs: - run: name: Install ansible-base (v<< parameters.ansible_version >>) - command: python 3.9 -m pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check + command: python3 -m pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - run: name: Install DCNM collection From ae8b0642e09078fd1598d851795eec983810f04c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 23 Jun 2023 09:06:26 +0530 Subject: [PATCH 039/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9d9e22adb..6c541c35c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,7 +89,7 @@ jobs: - run: name: Build a DCNM collection tarball - command: ansible-galaxy collection build --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" + command: ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" sanity: parameters: From d94bf08185524f0fcab133cf9a220546d96fb7d3 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 23 Jun 2023 09:45:30 +0530 Subject: [PATCH 040/248] Updated config.yml --- .circleci/config.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6c541c35c..b0afb52b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -73,11 +73,7 @@ jobs: - run: name: Install ansible-base (v<< parameters.ansible_version >>) - command: python3 -m pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - - - run: - name: Install DCNM collection - command: ansible-galaxy collection install cisco.dcnm + command: python3 --version 3.9 -m pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - run: name: Install coverage (v4.5.4) @@ -192,7 +188,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 - path-filtering/filter: requires: From 71b3e44ed989f63d24456c2093112ce66fee98de Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 23 Jun 2023 09:52:23 +0530 Subject: [PATCH 041/248] Updated config.yml --- .circleci/config.yml | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b0afb52b6..6e2a0f481 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -250,8 +250,6 @@ workflows: << pipeline.parameters.run-all-unit >> jobs: - unit-tests: - requires: - - build matrix: parameters: ansible_version: @@ -271,11 +269,9 @@ workflows: - << pipeline.parameters.run-interface >> jobs: - sanity: - requires: - - build + matrix: parameters: - modulename: - interface ansible_version: @@ -293,8 +289,7 @@ workflows: - << pipeline.parameters.run-inventory >> jobs: - sanity: - requires: - - build + matrix: parameters: @@ -315,8 +310,7 @@ workflows: - << pipeline.parameters.run-vrf >> jobs: - sanity: - requires: - - build + matrix: parameters: @@ -336,8 +330,7 @@ workflows: - << pipeline.parameters.run-links >> jobs: - sanity: - requires: - - build + matrix: parameters: @@ -357,8 +350,7 @@ workflows: - << pipeline.parameters.run-network >> jobs: - sanity: - requires: - - build + matrix: parameters: @@ -378,8 +370,7 @@ workflows: - << pipeline.parameters.run-policy >> jobs: - sanity: - requires: - - build + matrix: parameters: @@ -400,8 +391,7 @@ workflows: - << pipeline.parameters.run-resource_manager >> jobs: - sanity: - requires: - - build + matrix: parameters: @@ -422,8 +412,7 @@ workflows: - << pipeline.parameters.run-service_node >> jobs: - sanity: - requires: - - build + matrix: parameters: @@ -444,8 +433,7 @@ workflows: - << pipeline.parameters.run-service_policy >> jobs: - sanity: - requires: - - build + matrix: parameters: @@ -467,8 +455,7 @@ workflows: - << pipeline.parameters.run-service_route_peering >> jobs: - sanity: - requires: - - build + matrix: parameters: @@ -489,8 +476,7 @@ workflows: - << pipeline.parameters.run-template >> jobs: - sanity: - requires: - - build + matrix: parameters: @@ -511,8 +497,7 @@ workflows: - << pipeline.parameters.run-rest >> jobs: - sanity: - requires: - - build + matrix: parameters: modulename: From 6b0726c1e84dabc4846ac552c0e5dffaf0850417 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 23 Jun 2023 09:55:56 +0530 Subject: [PATCH 042/248] Updated config.yml --- .circleci/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e2a0f481..95fcfc016 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -101,9 +101,6 @@ jobs: steps: - checkout - - setup_remote_docker: - version: 20.10.7 - - run: name: Set up Python 3.9 command: | From 28df3142e1964ebecf560ea76349a4ab587c20d6 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 23 Jun 2023 10:07:01 +0530 Subject: [PATCH 043/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 95fcfc016..dfa7ef921 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -119,6 +119,7 @@ jobs: - run: name: Run DCNM Unit tests for << parameters.modulename >> command: | + ls -lrt coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py - run: From 8690bd5e4d16cc52480907a7cd344b8965a52e23 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 23 Jun 2023 10:42:06 +0530 Subject: [PATCH 044/248] Updated config.yml --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dfa7ef921..1527ae313 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -114,7 +114,7 @@ jobs: - run: name: Install the collection tarball - command: ansible-galaxy collection install ${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs/*.tar.gz + command: ansible-galaxy collection install --force ${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs/*.tar.gz - run: name: Run DCNM Unit tests for << parameters.modulename >> @@ -164,7 +164,7 @@ jobs: - run: name: Install the collection tarball - command: ansible-galaxy collection install ${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs/*.tar.gz + command: ansible-galaxy collection install --force ${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs/*.tar.gz - run: name: Run DCNM Unit tests From ed723f922e12c134bd769f151a7b2b630be344ea Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 23 Jun 2023 10:59:36 +0530 Subject: [PATCH 045/248] Updated config.yml --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1527ae313..faeabd389 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -94,7 +94,7 @@ jobs: modulename: type: string - working_directory: ~/repo + working_directory: ~/.ansible/collections machine: true resource_class: cisco/ansible-dcnm @@ -144,7 +144,7 @@ jobs: type: string - working_directory: ~/repo + working_directory: ~/.ansible/collections machine: true resource_class: cisco/ansible-dcnm From 7da5f8ca40ee25055dac650eed2b310c4f48301d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 23 Jun 2023 13:04:14 +0530 Subject: [PATCH 046/248] Updated config.yml --- .circleci/config.yml | 92 +++++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 32 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index faeabd389..9e2f47546 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,7 @@ orbs: parameters: + run-setup: type: boolean default: true @@ -55,7 +56,7 @@ parameters: jobs: build: - parameters: + parameters: ansible_version: type: string @@ -65,16 +66,6 @@ jobs: steps: - checkout - - run: - name: Set up Python 3.9 - command: | - sudo apt-get update - sudo apt-get install -y python3.9 - - - run: - name: Install ansible-base (v<< parameters.ansible_version >>) - command: python3 --version 3.9 -m pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - - run: name: Install coverage (v4.5.4) command: pip install coverage==4.5.4 @@ -84,8 +75,13 @@ jobs: command: pip install pytest==5.4.1 - run: - name: Build a DCNM collection tarball - command: ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" + name: Activate Python 3.9 Environment, Install ansible and Build collection tarball + command: | + pyenv local pyenv_3.9 + pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check + ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" + pyenv local system + sanity: parameters: @@ -93,6 +89,8 @@ jobs: type: string modulename: type: string + py_version: + type: string working_directory: ~/.ansible/collections machine: true @@ -102,10 +100,12 @@ jobs: - checkout - run: - name: Set up Python 3.9 + name: Activating Python << parameters.modulename >> env command: | - sudo apt-get update - sudo apt-get install -y python3.9 + pyenv local pyenv_<< parameters.modulename >> + environment: + PYTHONPATH: /home/circleci/.ansible/collections/:$PYTHONPATH + - run: name: Install ansible-base (v<< parameters.ansible_version >>) @@ -127,11 +127,13 @@ jobs: command: echo done # command: ansible-test sanity --python 3.8 -v --color --truncate 0 # environment: - # PYTHONPATH: /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm + # PYTHONPATH: /home/circleci/.ansible/collections/ - run: name: Run sanity tests py 3.9 for << parameters.modulename >> - command: echo done + command: | + echo done + pyenv local system # command: ansible-test sanity --python 3.9 -v --color --truncate 0 # environment: # PYTHONPATH: /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm @@ -144,7 +146,7 @@ jobs: type: string - working_directory: ~/.ansible/collections + working_directory: ~/repo machine: true resource_class: cisco/ansible-dcnm @@ -152,10 +154,9 @@ jobs: - checkout - run: - name: Set up Python 3.9 + name: Activate Python 3.9 Environment command: | - sudo apt-get update - sudo apt-get install -y python3.9 + pyenv local pyenv_3.9 - run: name: Install ansible-base (v<< parameters.ansible_version >>) @@ -250,6 +251,7 @@ workflows: - unit-tests: matrix: parameters: + ansible_version: - 2.9.26 - 2.10.17 @@ -270,6 +272,9 @@ workflows: matrix: parameters: + py_version: + - "3.8" + - "3.9" modulename: - interface ansible_version: @@ -290,7 +295,9 @@ workflows: matrix: parameters: - + py_version: + - "3.8" + - "3.9" modulename: - inventory ansible_version: @@ -311,7 +318,9 @@ workflows: matrix: parameters: - + py_version: + - "3.8" + - "3.9" modulename: - vrf ansible_version: @@ -331,7 +340,9 @@ workflows: matrix: parameters: - + py_version: + - "3.8" + - "3.9" modulename: - links ansible_version: @@ -351,7 +362,9 @@ workflows: matrix: parameters: - + py_version: + - "3.8" + - "3.9" modulename: - network ansible_version: @@ -371,7 +384,9 @@ workflows: matrix: parameters: - + py_version: + - "3.8" + - "3.9" modulename: - policy ansible_version: @@ -392,7 +407,9 @@ workflows: matrix: parameters: - + py_version: + - "3.8" + - "3.9" modulename: - resource_manager ansible_version: @@ -413,7 +430,9 @@ workflows: matrix: parameters: - + py_version: + - "3.8" + - "3.9" modulename: - service_node ansible_version: @@ -434,7 +453,9 @@ workflows: matrix: parameters: - + py_version: + - "3.8" + - "3.9" modulename: - service_policy_job ansible_version: @@ -456,7 +477,9 @@ workflows: matrix: parameters: - + py_version: + - "3.8" + - "3.9" modulename: - service_route_peering ansible_version: @@ -477,7 +500,9 @@ workflows: matrix: parameters: - + py_version: + - "3.8" + - "3.9" modulename: - template ansible_version: @@ -498,6 +523,9 @@ workflows: matrix: parameters: + py_version: + - "3.8" + - "3.9" modulename: - rest ansible_version: From e8d090d682259e6ff3436e5f966469afe204d628 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 26 Jun 2023 08:54:51 +0530 Subject: [PATCH 047/248] Updated config.yml --- .circleci/config.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9e2f47546..902af6c58 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,20 +66,16 @@ jobs: steps: - checkout - - run: - name: Install coverage (v4.5.4) - command: pip install coverage==4.5.4 - - - run: - name: Install pytest (v5.4.1) - command: pip install pytest==5.4.1 - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | + cat ~/.bashrc pyenv local pyenv_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" + pip install pytest==5.4.1 + pip install coverage==4.5.4 pyenv local system From a2a0465bd91585422f08a5b0aa07822e80e4f6f4 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 26 Jun 2023 09:04:50 +0530 Subject: [PATCH 048/248] Updated config.yml --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 902af6c58..96587327c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,6 +70,9 @@ jobs: - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | + echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc + echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc + echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc cat ~/.bashrc pyenv local pyenv_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check From 708349dec5bf4836a624832c4e1500c1fe8ac48c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 26 Jun 2023 09:10:03 +0530 Subject: [PATCH 049/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 96587327c..85584ef6d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,7 +72,7 @@ jobs: command: | echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc - echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc + echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc cat ~/.bashrc pyenv local pyenv_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check From 743a37b3eb8d85bbc3ad615665175219104a274d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 26 Jun 2023 14:55:45 +0530 Subject: [PATCH 050/248] Updated config.yml --- .circleci/config.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 85584ef6d..fe6d910c1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,11 +70,8 @@ jobs: - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | - echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc - echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc - echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc - cat ~/.bashrc - pyenv local pyenv_3.9 + pip list + pyenv local python_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" pip install pytest==5.4.1 @@ -101,7 +98,7 @@ jobs: - run: name: Activating Python << parameters.modulename >> env command: | - pyenv local pyenv_<< parameters.modulename >> + pyenv local python_<< parameters.modulename >> environment: PYTHONPATH: /home/circleci/.ansible/collections/:$PYTHONPATH From 199ee61294a396793966935a56e95d6a713c2da4 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 26 Jun 2023 15:23:15 +0530 Subject: [PATCH 051/248] Updated config.yml --- .circleci/config.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index fe6d910c1..da77a8530 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,6 +67,17 @@ jobs: steps: - checkout + - run: + name: Download pyenv + command: | + sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ + libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ + xz-utils tk-dev libffi-dev liblzma-dev python-openssl git + curl https://pyenv.run | bash + echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc + echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc + echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc + - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | From 0ffcc1c8e3d0aa954af5767a3417a4b3fa24caeb Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 26 Jun 2023 15:38:46 +0530 Subject: [PATCH 052/248] Updated config.yml --- .circleci/config.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index da77a8530..391e1d4ab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,10 +70,8 @@ jobs: - run: name: Download pyenv command: | - sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ - libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ - xz-utils tk-dev libffi-dev liblzma-dev python-openssl git - curl https://pyenv.run | bash + curl https://pyenv.run + bash echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc From 6b484eb3e0cd337a2d181cddc6475e14d1e9e31c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 26 Jun 2023 15:41:48 +0530 Subject: [PATCH 053/248] Updated config.yml --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 391e1d4ab..a4282acd1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,8 +70,7 @@ jobs: - run: name: Download pyenv command: | - curl https://pyenv.run - bash + curl https://pyenv.run | bash echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc From e376c1f9493975f8b5b9edcee328cef8d6ecda38 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 26 Jun 2023 15:44:07 +0530 Subject: [PATCH 054/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a4282acd1..997310bba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -71,6 +71,7 @@ jobs: name: Download pyenv command: | curl https://pyenv.run | bash + yes echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc From 4c3fb740ed034b1d1424757bae365b4bddf65d0c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 26 Jun 2023 15:46:53 +0530 Subject: [PATCH 055/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 997310bba..793c6ae9b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,8 +70,8 @@ jobs: - run: name: Download pyenv command: | + ssh-keyscan github.com >> ~/.ssh/known_hosts curl https://pyenv.run | bash - yes echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc From 5d1dbb41122877427f90a43a4617ddc473c0208a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 10:05:12 +0530 Subject: [PATCH 056/248] Updated config.yml --- .circleci/config.yml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 793c6ae9b..289cdc675 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -55,27 +55,36 @@ parameters: default: false jobs: - build: - parameters: - ansible_version: - type: string - + install: working_directory: ~/repo machine: true resource_class: cisco/ansible-dcnm - steps: - checkout - run: name: Download pyenv command: | + pwd ssh-keyscan github.com >> ~/.ssh/known_hosts - curl https://pyenv.run | bash + cat ~/.ssh/known_hosts + curl https://pyenv.run | bash | echo done echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc + build: + parameters: + ansible_version: + type: string + + working_directory: ~/repo + machine: true + resource_class: cisco/ansible-dcnm + + steps: + - checkout + - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | @@ -86,8 +95,7 @@ jobs: pip install pytest==5.4.1 pip install coverage==4.5.4 pyenv local system - - + sanity: parameters: ansible_version: @@ -182,7 +190,7 @@ workflows: pre: when: << pipeline.parameters.run-setup >> jobs: - + - install - build: matrix: parameters: From a6a04de20437f5c57900208db95ddae9f79c5c2a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 10:12:16 +0530 Subject: [PATCH 057/248] Updated config.yml --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 289cdc675..2451729d1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,7 +72,8 @@ jobs: echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc - + cat ~/.bashrc + exec bash build: parameters: ansible_version: @@ -192,6 +193,8 @@ workflows: jobs: - install - build: + requires: + - install matrix: parameters: ansible_version: From 4ec27079848a08811410274d5b3067d3dac938cc Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 10:38:48 +0530 Subject: [PATCH 058/248] Updated config.yml --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2451729d1..b6ae8e264 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,9 +66,10 @@ jobs: name: Download pyenv command: | pwd + set +e ssh-keyscan github.com >> ~/.ssh/known_hosts cat ~/.ssh/known_hosts - curl https://pyenv.run | bash | echo done + curl https://pyenv.run | bash || true echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc From d62e8d81938a30c2dcafc41c7e134cd295a1f4bb Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 10:43:20 +0530 Subject: [PATCH 059/248] Updated config.yml --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b6ae8e264..1fa764011 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -74,7 +74,8 @@ jobs: echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc cat ~/.bashrc - exec bash + source ~/.bashrc + build: parameters: ansible_version: From b3bd32569bfc997ff1f4bdddbd6372edd34a450c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 11:10:57 +0530 Subject: [PATCH 060/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1fa764011..ac6827fcf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -75,6 +75,7 @@ jobs: echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc cat ~/.bashrc source ~/.bashrc + pip list build: parameters: From 51710b2e18ee1d0e6f3a3bb2c887bac401b67393 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 11:17:28 +0530 Subject: [PATCH 061/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index ac6827fcf..5912426df 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,6 +66,7 @@ jobs: name: Download pyenv command: | pwd + cat ${HOME} set +e ssh-keyscan github.com >> ~/.ssh/known_hosts cat ~/.ssh/known_hosts From ee551ed39c1039cef006f8f087f81c4cecd7f8bc Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 11:18:40 +0530 Subject: [PATCH 062/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5912426df..278b3bcb5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,7 +66,7 @@ jobs: name: Download pyenv command: | pwd - cat ${HOME} + ${HOME} set +e ssh-keyscan github.com >> ~/.ssh/known_hosts cat ~/.ssh/known_hosts From 9eb014d2c31bd1181f113710b01ee10cee8a925f Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 11:32:03 +0530 Subject: [PATCH 063/248] Updated config.yml --- .circleci/config.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 278b3bcb5..214628bb9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,16 +68,11 @@ jobs: pwd ${HOME} set +e - ssh-keyscan github.com >> ~/.ssh/known_hosts cat ~/.ssh/known_hosts - curl https://pyenv.run | bash || true - echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc - echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc - echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc cat ~/.bashrc source ~/.bashrc pip list - + who am i build: parameters: ansible_version: @@ -94,6 +89,7 @@ jobs: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | pip list + who am i pyenv local python_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" From cc38e592679dc876c935690b44196c33d5996c35 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 11:35:48 +0530 Subject: [PATCH 064/248] Updated config.yml --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 214628bb9..6d16a2a7f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,12 +61,11 @@ jobs: resource_class: cisco/ansible-dcnm steps: - checkout - - run: name: Download pyenv command: | pwd - ${HOME} + echo ${HOME} set +e cat ~/.ssh/known_hosts cat ~/.bashrc From db28e8e8def78fce0bc3fa7156727307c200d8b4 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 11:44:54 +0530 Subject: [PATCH 065/248] Updated config.yml --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d16a2a7f..f10d2cc7e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,7 +56,7 @@ parameters: jobs: install: - working_directory: ~/repo + working_directory: /home/circleci machine: true resource_class: cisco/ansible-dcnm steps: @@ -71,13 +71,13 @@ jobs: cat ~/.bashrc source ~/.bashrc pip list - who am i + whoami build: parameters: ansible_version: type: string - working_directory: ~/repo + working_directory: /home/circleci machine: true resource_class: cisco/ansible-dcnm @@ -88,7 +88,7 @@ jobs: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | pip list - who am i + whoami pyenv local python_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" From e659783999ac9d801450bc94737f1b71f80c77d1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 11:46:34 +0530 Subject: [PATCH 066/248] Updated config.yml --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f10d2cc7e..4cee05eaf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,7 +56,7 @@ parameters: jobs: install: - working_directory: /home/circleci + working_directory: ~/repo machine: true resource_class: cisco/ansible-dcnm steps: @@ -77,7 +77,7 @@ jobs: ansible_version: type: string - working_directory: /home/circleci + working_directory: ~/repo machine: true resource_class: cisco/ansible-dcnm From d15ef2cf8ba8d9eff3de9f22e1490b9f4bc628b1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 12:11:55 +0530 Subject: [PATCH 067/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4cee05eaf..d2b77a131 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,6 +89,7 @@ jobs: command: | pip list whoami + env pyenv local python_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" From 5844aaea98a1487ee2949774d76f2743b7923551 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 12:15:16 +0530 Subject: [PATCH 068/248] Updated config.yml --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d2b77a131..eac83c110 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,6 +90,8 @@ jobs: pip list whoami env + source ~/.bashrc + env pyenv local python_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" From 9874f05e98f234bb3130936627f5a7de75b72262 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 12:21:24 +0530 Subject: [PATCH 069/248] Updated config.yml --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eac83c110..99451a38f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,8 +89,9 @@ jobs: command: | pip list whoami - env - source ~/.bashrc + export PYENV_ROOT="$HOME/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + cat ~/.bashrc env pyenv local python_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check From f130ed5129e0eff8c166f12377b19e6a91345937 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 14:44:32 +0530 Subject: [PATCH 070/248] Updated config.yml --- .circleci/config.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 99451a38f..80706e660 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,6 +95,7 @@ jobs: env pyenv local python_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check + ansible -version ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" pip install pytest==5.4.1 pip install coverage==4.5.4 @@ -194,10 +195,10 @@ workflows: pre: when: << pipeline.parameters.run-setup >> jobs: - - install + - build: - requires: - - install + #requires: + # - install matrix: parameters: ansible_version: From eb983af2c3d00c0c323085dcb4beb19fff0ea4ca Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 14:49:04 +0530 Subject: [PATCH 071/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 80706e660..6bb0af980 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,7 +95,7 @@ jobs: env pyenv local python_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - ansible -version + ansible --version ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" pip install pytest==5.4.1 pip install coverage==4.5.4 From aec7f06a0843a10c9168e33c647f411aa57e766a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 15:10:04 +0530 Subject: [PATCH 072/248] Updated config.yml --- .circleci/config.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6bb0af980..0dae7e0fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,15 +87,13 @@ jobs: - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | - pip list - whoami export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" - cat ~/.bashrc - env + pyenv local python_3.9 pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible --version + pyenv versions ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" pip install pytest==5.4.1 pip install coverage==4.5.4 @@ -110,7 +108,7 @@ jobs: py_version: type: string - working_directory: ~/.ansible/collections + working_directory: ~/repo machine: true resource_class: cisco/ansible-dcnm @@ -118,11 +116,12 @@ jobs: - checkout - run: - name: Activating Python << parameters.modulename >> env + name: Activating Python << parameters.py_version >> env for << parameters.modulename >> command: | - pyenv local python_<< parameters.modulename >> + pyenv local python_<< parameters.py_version >> + pyenv local environment: - PYTHONPATH: /home/circleci/.ansible/collections/:$PYTHONPATH + PYTHONPATH: /root/.ansible/collections/:$PYTHONPATH - run: @@ -207,7 +206,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - # - 2.14.2 + - 2.14.2 - path-filtering/filter: requires: From 3babc0c5583f1b92db13e7e5877ff7ca5b076d86 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 15:22:38 +0530 Subject: [PATCH 073/248] Updated config.yml --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0dae7e0fa..88dc6f1dc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,8 +89,9 @@ jobs: command: | export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" - + which python pyenv local python_3.9 + which python pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible --version pyenv versions From d012193e3ef60087996ebbd77b70b07b28ec3d2d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 15:24:39 +0530 Subject: [PATCH 074/248] Updated config.yml --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 88dc6f1dc..a7f4b8e72 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,9 +89,9 @@ jobs: command: | export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" - which python + python --version pyenv local python_3.9 - which python + python --version pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible --version pyenv versions From 081bc86d288e5d5ca2a5676289ad652acf53080f Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 15:26:46 +0530 Subject: [PATCH 075/248] Updated config.yml --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a7f4b8e72..53dc15961 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,7 +89,6 @@ jobs: command: | export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" - python --version pyenv local python_3.9 python --version pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check From 96c908a3a2927565ac74d86a5d8f0123b68e1242 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 15:32:37 +0530 Subject: [PATCH 076/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 53dc15961..a271f4d8d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,7 +90,7 @@ jobs: export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" pyenv local python_3.9 - python --version + python3 --version pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible --version pyenv versions From 08836ad0515cf6cb357c1a85197c85b023550a5d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 15:38:19 +0530 Subject: [PATCH 077/248] Updated config.yml --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a271f4d8d..c2f33297a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,7 +89,9 @@ jobs: command: | export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" + which python3 pyenv local python_3.9 + which python3 python3 --version pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible --version From b68c6c707ee11dbb8bc1cb0e4d318c12f458c336 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 15:41:38 +0530 Subject: [PATCH 078/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c2f33297a..4b092c4a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,7 +88,7 @@ jobs: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | export PYENV_ROOT="$HOME/.pyenv" - export PATH="$PYENV_ROOT/bin:$PATH" + export PATH="$PYENV_ROOT/shims/python3:$PATH" which python3 pyenv local python_3.9 which python3 From 7ea8639908db50058856b8b53611dcb43e45e055 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:42:49 +0530 Subject: [PATCH 079/248] Updated config.yml --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b092c4a6..5517426af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,7 +88,8 @@ jobs: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | export PYENV_ROOT="$HOME/.pyenv" - export PATH="$PYENV_ROOT/shims/python3:$PATH" + export PATH="$PYENV_ROOT/bin:$PATH" + which python3 pyenv local python_3.9 which python3 From 5f970b46ae9e888a280fbbc0db44690c27bdcfb6 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:48:50 +0530 Subject: [PATCH 080/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5517426af..0d6c800e5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,6 +89,7 @@ jobs: command: | export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" + export PATH="$PYENV_ROOT/shims/python3:$PATH" which python3 pyenv local python_3.9 From b375658af49e60032ce79865e173cad774674ea4 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:53:18 +0530 Subject: [PATCH 081/248] Updated config.yml --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d6c800e5..6e284c3a9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,7 +90,8 @@ jobs: export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" export PATH="$PYENV_ROOT/shims/python3:$PATH" - + export PYTHONPATH="$PYENV_ROOT/shims/python3" + echo $PYHTONPATH which python3 pyenv local python_3.9 which python3 From da10aa08a98744f2ce9c9067edc07ead5444d983 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 18:54:21 +0530 Subject: [PATCH 082/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e284c3a9..559119d43 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,7 +91,7 @@ jobs: export PATH="$PYENV_ROOT/bin:$PATH" export PATH="$PYENV_ROOT/shims/python3:$PATH" export PYTHONPATH="$PYENV_ROOT/shims/python3" - echo $PYHTONPATH + echo $PYTHONPATH which python3 pyenv local python_3.9 which python3 From 84df16f857f02cd51d91383d75313beb2132ff20 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:39:38 +0530 Subject: [PATCH 083/248] Updated config.yml --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 559119d43..dbdec8143 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,10 +92,10 @@ jobs: export PATH="$PYENV_ROOT/shims/python3:$PATH" export PYTHONPATH="$PYENV_ROOT/shims/python3" echo $PYTHONPATH - which python3 - pyenv local python_3.9 - which python3 - python3 --version + + /home/circleci/.pyenv/bin/pyenv local python_3.9 + which python + python --version pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible --version pyenv versions From 0f3d173c4a9b284265ec3c490f2570efe3faa649 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:43:57 +0530 Subject: [PATCH 084/248] Updated config.yml --- .circleci/config.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dbdec8143..ca73e737d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,22 +87,10 @@ jobs: - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | - export PYENV_ROOT="$HOME/.pyenv" - export PATH="$PYENV_ROOT/bin:$PATH" - export PATH="$PYENV_ROOT/shims/python3:$PATH" - export PYTHONPATH="$PYENV_ROOT/shims/python3" - echo $PYTHONPATH /home/circleci/.pyenv/bin/pyenv local python_3.9 - which python - python --version - pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check - ansible --version - pyenv versions - ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" - pip install pytest==5.4.1 - pip install coverage==4.5.4 - pyenv local system + /home/circleci/.pyenv/bin/pyenv versions + sanity: parameters: From 7faebdbfa3fdcd152610a947267939a1f22bfdf2 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:55:16 +0530 Subject: [PATCH 085/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ca73e737d..3dd744290 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,7 +90,7 @@ jobs: /home/circleci/.pyenv/bin/pyenv local python_3.9 /home/circleci/.pyenv/bin/pyenv versions - + python --version sanity: parameters: From 683c866f7f874a78a0bfbac1674affcc9b0c574d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:59:15 +0530 Subject: [PATCH 086/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3dd744290..93628ccaa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,6 +90,7 @@ jobs: /home/circleci/.pyenv/bin/pyenv local python_3.9 /home/circleci/.pyenv/bin/pyenv versions + python --version sanity: From 08d2f17a82451eb91ab0df2c895fdd2951599391 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:00:29 +0530 Subject: [PATCH 087/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 93628ccaa..de6ecfca5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,8 +90,8 @@ jobs: /home/circleci/.pyenv/bin/pyenv local python_3.9 /home/circleci/.pyenv/bin/pyenv versions + /root/.pyenv/shims/python --version - python --version sanity: parameters: From 00a17020c86147732caec20c7df5b447ea952355 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:05:57 +0530 Subject: [PATCH 088/248] Updated config.yml --- .circleci/config.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index de6ecfca5..4fe3ef927 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,10 +87,22 @@ jobs: - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | - + export PYENV_ROOT="/root/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + export PATH="$PYENV_ROOT/shims/python3:$PATH" + export PATH="$PYENV_ROOT/shims/python:$PATH" + export PYTHONPATH="$PYENV_ROOT/shims/python3" + echo $PYTHONPATH + echo $PATH + echo $HOME + echo $PYENV_ROOT /home/circleci/.pyenv/bin/pyenv local python_3.9 /home/circleci/.pyenv/bin/pyenv versions + /root/.pyenv/shims/python --version + python3 --version + python --version + sanity: From e96d80f0ffa71dc8c640b68477919574b78db303 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:09:37 +0530 Subject: [PATCH 089/248] Updated config.yml --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4fe3ef927..5cef98181 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,7 +98,6 @@ jobs: echo $PYENV_ROOT /home/circleci/.pyenv/bin/pyenv local python_3.9 /home/circleci/.pyenv/bin/pyenv versions - /root/.pyenv/shims/python --version python3 --version python --version From 4525d4bb198bf295d932d5d2f1d85cea9fa62e5c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:14:05 +0530 Subject: [PATCH 090/248] Updated config.yml --- .circleci/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5cef98181..de1e7f241 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,8 +102,6 @@ jobs: python3 --version python --version - - sanity: parameters: ansible_version: From c1d71aae5c07dd3178165fde389e68119a80559c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:18:13 +0530 Subject: [PATCH 091/248] Updated config.yml --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index de1e7f241..c7499d91b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,7 +91,8 @@ jobs: export PATH="$PYENV_ROOT/bin:$PATH" export PATH="$PYENV_ROOT/shims/python3:$PATH" export PATH="$PYENV_ROOT/shims/python:$PATH" - export PYTHONPATH="$PYENV_ROOT/shims/python3" + export PYTHONPATH="$PYENV_ROOT/shims/python3:$PYTHONPATH" + export PYTHONPATH="$PYENV_ROOT/shims/python:$PYTHONPATH" echo $PYTHONPATH echo $PATH echo $HOME From 17b78143b2e210f1805e564c69fac8a3a0a3c9e7 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:27:30 +0530 Subject: [PATCH 092/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index c7499d91b..429d1f849 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,6 +93,7 @@ jobs: export PATH="$PYENV_ROOT/shims/python:$PATH" export PYTHONPATH="$PYENV_ROOT/shims/python3:$PYTHONPATH" export PYTHONPATH="$PYENV_ROOT/shims/python:$PYTHONPATH" + echo $PYTHONPATH echo $PATH echo $HOME From 9f6360523d81bedfab742fabb4fa5796209c0d59 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:29:08 +0530 Subject: [PATCH 093/248] Updated config.yml --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 429d1f849..129c794cd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,11 +93,14 @@ jobs: export PATH="$PYENV_ROOT/shims/python:$PATH" export PYTHONPATH="$PYENV_ROOT/shims/python3:$PYTHONPATH" export PYTHONPATH="$PYENV_ROOT/shims/python:$PYTHONPATH" - + echo "**********************" + whoami + echo "**********************" echo $PYTHONPATH echo $PATH echo $HOME echo $PYENV_ROOT + echo "**********************" /home/circleci/.pyenv/bin/pyenv local python_3.9 /home/circleci/.pyenv/bin/pyenv versions /root/.pyenv/shims/python --version From 9fff5f1efab99e8001c748d00e1c81893f16e4e8 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:32:15 +0530 Subject: [PATCH 094/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 129c794cd..c5fa28b55 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,7 +87,7 @@ jobs: - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | - export PYENV_ROOT="/root/.pyenv" + export PYENV_ROOT="/home/circleci/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" export PATH="$PYENV_ROOT/shims/python3:$PATH" export PATH="$PYENV_ROOT/shims/python:$PATH" From 391648306bae49556b6f2b86c169e0d5794fa2de Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:33:27 +0530 Subject: [PATCH 095/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c5fa28b55..360d99cdf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,7 +103,7 @@ jobs: echo "**********************" /home/circleci/.pyenv/bin/pyenv local python_3.9 /home/circleci/.pyenv/bin/pyenv versions - /root/.pyenv/shims/python --version + /home/circleci/.pyenv/shims/python --version python3 --version python --version From 1d9049727036aba4089bccc4d39bdc3803585341 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 28 Jun 2023 09:43:44 +0530 Subject: [PATCH 096/248] Updated config.yml --- .circleci/config.yml | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 360d99cdf..203e82804 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -55,23 +55,6 @@ parameters: default: false jobs: - install: - working_directory: ~/repo - machine: true - resource_class: cisco/ansible-dcnm - steps: - - checkout - - run: - name: Download pyenv - command: | - pwd - echo ${HOME} - set +e - cat ~/.ssh/known_hosts - cat ~/.bashrc - source ~/.bashrc - pip list - whoami build: parameters: ansible_version: @@ -102,10 +85,18 @@ jobs: echo $PYENV_ROOT echo "**********************" /home/circleci/.pyenv/bin/pyenv local python_3.9 - /home/circleci/.pyenv/bin/pyenv versions - /home/circleci/.pyenv/shims/python --version - python3 --version - python --version + # /home/circleci/.pyenv/bin/pyenv versions + # /home/circleci/.pyenv/shims/python --version + # python3 --version + # python --version + + pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check + ansible --version + pyenv versions + ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" + pip install pytest==5.4.1 + pip install coverage==4.5.4 + pyenv local system sanity: parameters: @@ -202,10 +193,7 @@ workflows: pre: when: << pipeline.parameters.run-setup >> jobs: - - build: - #requires: - # - install matrix: parameters: ansible_version: From e3a46c37251960545f947feff59746534d464c9f Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 28 Jun 2023 10:14:42 +0530 Subject: [PATCH 097/248] Updated config.yml --- .circleci/config.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 203e82804..adbfb26cb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -117,10 +117,20 @@ jobs: - run: name: Activating Python << parameters.py_version >> env for << parameters.modulename >> command: | + export PYENV_ROOT="/home/circleci/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + export PATH="$PYENV_ROOT/shims/python3:$PATH" + export PATH="$PYENV_ROOT/shims/python:$PATH" + export PYTHONPATH="$PYENV_ROOT/shims/python3:$PYTHONPATH" + export PYTHONPATH="$PYENV_ROOT/shims/python:$PYTHONPATH" + + export PATH="/home/circleci/.ansible/collections/:$PATH" + export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" + pyenv local python_<< parameters.py_version >> - pyenv local + environment: - PYTHONPATH: /root/.ansible/collections/:$PYTHONPATH + PYTHONPATH: /home/circleci/.ansible/collections/:$PYTHONPATH - run: From 97456ece0cf7fd9d0518ceee11e0cccfa5cf002d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 28 Jun 2023 10:21:23 +0530 Subject: [PATCH 098/248] Updated config.yml --- .circleci/config.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index adbfb26cb..a463fe371 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -140,7 +140,11 @@ jobs: - run: name: Install the collection tarball - command: ansible-galaxy collection install --force ${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs/*.tar.gz + command: | + pyenv versions + python --version + ansible --version + ansible-galaxy collection install --force ${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs/*.tar.gz - run: name: Run DCNM Unit tests for << parameters.modulename >> @@ -149,7 +153,7 @@ jobs: coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py - run: - name: Run sanity tests py 3.8 for << parameters.modulename >> + name: Run sanity tests py << parameters.py_version >> for << parameters.modulename >> command: echo done # command: ansible-test sanity --python 3.8 -v --color --truncate 0 # environment: From bb3fa874d3e200991d543cc3547c3a2561c6922a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 28 Jun 2023 10:34:09 +0530 Subject: [PATCH 099/248] Updated config.yml --- .circleci/config.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a463fe371..8308cbe10 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,6 +150,8 @@ jobs: name: Run DCNM Unit tests for << parameters.modulename >> command: | ls -lrt + export PATH="home/circleci/.ansible/collections/:$PATH" + echo $PATH coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py - run: @@ -159,15 +161,6 @@ jobs: # environment: # PYTHONPATH: /home/circleci/.ansible/collections/ - - run: - name: Run sanity tests py 3.9 for << parameters.modulename >> - command: | - echo done - pyenv local system - # command: ansible-test sanity --python 3.9 -v --color --truncate 0 - # environment: - # PYTHONPATH: /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm - unit-tests: From b2c628c18a1df753ac9a6be585c1c1420f312e5a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 28 Jun 2023 10:53:12 +0530 Subject: [PATCH 100/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8308cbe10..5d0e1f5d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -151,6 +151,7 @@ jobs: command: | ls -lrt export PATH="home/circleci/.ansible/collections/:$PATH" + export PYTHONPATH="home/circleci/.ansible/collections/:$PYTHONPATH" echo $PATH coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py From 87888666d1777dcc283b6190cc20c7e3feaeceed Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 28 Jun 2023 11:09:15 +0530 Subject: [PATCH 101/248] Updated config.yml --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d0e1f5d9..dec32bf47 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,8 +150,8 @@ jobs: name: Run DCNM Unit tests for << parameters.modulename >> command: | ls -lrt - export PATH="home/circleci/.ansible/collections/:$PATH" - export PYTHONPATH="home/circleci/.ansible/collections/:$PYTHONPATH" + export PATH="home/circleci/.ansible/collections/ansible_collections/:$PATH" + export PYTHONPATH="home/circleci/.ansible/collections/ansible_collections/:$PYTHONPATH" echo $PATH coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py From 6855242cf42ac2046af58089251c9d415f825ffc Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 28 Jun 2023 12:36:14 +0530 Subject: [PATCH 102/248] Updated config.yml --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dec32bf47..5d0e1f5d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,8 +150,8 @@ jobs: name: Run DCNM Unit tests for << parameters.modulename >> command: | ls -lrt - export PATH="home/circleci/.ansible/collections/ansible_collections/:$PATH" - export PYTHONPATH="home/circleci/.ansible/collections/ansible_collections/:$PYTHONPATH" + export PATH="home/circleci/.ansible/collections/:$PATH" + export PYTHONPATH="home/circleci/.ansible/collections/:$PYTHONPATH" echo $PATH coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py From 674f60613ea0d82615bee5417ad2f5cab4e4ecfb Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 28 Jun 2023 14:26:45 +0530 Subject: [PATCH 103/248] Updated config.yml --- .circleci/config.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d0e1f5d9..8f2713f73 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -153,6 +153,7 @@ jobs: export PATH="home/circleci/.ansible/collections/:$PATH" export PYTHONPATH="home/circleci/.ansible/collections/:$PYTHONPATH" echo $PATH + echo $PYTHONPATH coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py - run: @@ -205,11 +206,11 @@ workflows: matrix: parameters: ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 + # - 2.9.26 + # - 2.10.17 + # - 2.11.12 + # - 2.12.10 + # - 2.13.8 - 2.14.2 - path-filtering/filter: From 4ed910c36e912ed54fb29ef59089f3cd6261fb42 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 28 Jun 2023 14:51:45 +0530 Subject: [PATCH 104/248] Updated config.yml --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f2713f73..61db7330f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,10 +150,11 @@ jobs: name: Run DCNM Unit tests for << parameters.modulename >> command: | ls -lrt - export PATH="home/circleci/.ansible/collections/:$PATH" - export PYTHONPATH="home/circleci/.ansible/collections/:$PYTHONPATH" + export PATH="/home/circleci/.ansible/collections/:$PATH" + export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" echo $PATH echo $PYTHONPATH + cd /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py - run: From ed220280e2e6e7af247f7a4dbf9edd6fb6117c81 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 28 Jun 2023 15:34:45 +0530 Subject: [PATCH 105/248] Updated config.yml --- .circleci/config.yml | 46 ++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 61db7330f..41e42626b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ orbs: parameters: - + run-setup: type: boolean default: true @@ -148,13 +148,13 @@ jobs: - run: name: Run DCNM Unit tests for << parameters.modulename >> + # cd /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm command: | ls -lrt export PATH="/home/circleci/.ansible/collections/:$PATH" export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" echo $PATH echo $PYTHONPATH - cd /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py - run: @@ -170,19 +170,34 @@ jobs: parameters: ansible_version: type: string - - + py_version: + type: string + working_directory: ~/repo machine: true resource_class: cisco/ansible-dcnm steps: - checkout - + - run: - name: Activate Python 3.9 Environment + name: Activating Python << parameters.py_version >> env command: | - pyenv local pyenv_3.9 + export PYENV_ROOT="/home/circleci/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + export PATH="$PYENV_ROOT/shims/python3:$PATH" + export PATH="$PYENV_ROOT/shims/python:$PATH" + export PYTHONPATH="$PYENV_ROOT/shims/python3:$PYTHONPATH" + export PYTHONPATH="$PYENV_ROOT/shims/python:$PYTHONPATH" + + export PATH="/home/circleci/.ansible/collections/:$PATH" + export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" + + pyenv local python_<< parameters.py_version >> + + environment: + PYTHONPATH: /home/circleci/.ansible/collections/:$PYTHONPATH + - run: name: Install ansible-base (v<< parameters.ansible_version >>) @@ -196,6 +211,8 @@ jobs: - run: name: Run DCNM Unit tests command: | + export PATH="/home/circleci/.ansible/collections/:$PATH" + export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" coverage run --source=. -m pytest tests/unit/modules/dcnm/. @@ -208,11 +225,11 @@ workflows: parameters: ansible_version: # - 2.9.26 - # - 2.10.17 - # - 2.11.12 - # - 2.12.10 - # - 2.13.8 - - 2.14.2 + # - 2.10.17 + # - 2.11.12 + # - 2.12.10 + - 2.13.8 + # - 2.14.2 - path-filtering/filter: requires: @@ -276,7 +293,9 @@ workflows: - unit-tests: matrix: parameters: - + py_version: + - "3.8" + - "3.9" ansible_version: - 2.9.26 - 2.10.17 @@ -406,7 +425,6 @@ workflows: - << pipeline.parameters.run-policy >> jobs: - sanity: - matrix: parameters: py_version: From 99140cf84d06bcd3f3059e0ebac04d61528e43e4 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 3 Jul 2023 09:58:00 +0530 Subject: [PATCH 106/248] Create sanity.yml --- .../targets/dcnm_vrf/tests/dcnm/sanity.yml | 529 ++++++++++++++++++ 1 file changed, 529 insertions(+) create mode 100644 tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yml diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yml new file mode 100644 index 000000000..85a0581e7 --- /dev/null +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yml @@ -0,0 +1,529 @@ +############################################## +## SETUP ## +############################################## + +- set_fact: + rest_path: "/rest/control/fabrics/{{ test_fabric }}" + when: controller_version == "11" + tags: + - sanity + +- set_fact: + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" + when: controller_version >= "12" + tags: + - sanity + +- name: MERGED - Verify if fabric is deployed. + cisco.dcnm.dcnm_rest: + method: GET + path: "{{ rest_path }}" + register: result + tags: sanity + +- assert: + that: + - 'result.response.DATA != None' + tags: sanity + +- name: MERGED - Clean up any existing vrfs + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: deleted + tags: sanity +############################################### +### MERGED ## +############################################### + +- name: MERGED - Create, Attach and Deploy new VRF - VLAN Provided by the User + cisco.dcnm.dcnm_vrf: &conf + fabric: "{{ test_fabric }}" + 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: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + deploy: true + register: result + tags: sanity + +- name: Query fabric state until vrfStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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' + - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address' + - '"{{ ansible_switch2 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: MERGED - conf1 - Idempotence + cisco.dcnm.dcnm_vrf: *conf + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + - 'result.response|length == 0' + tags: sanity + +- name: MERGED - Clean up any existing vrfs + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: deleted + tags: sanity + +############################################### +### REPLACED ## +############################################### + +- name: REPLACED - Create, Attach and Deploy new VRF - VLAN Provided by the User + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + 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: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + deploy: true + register: result + tags: sanity + +- name: Query fabric state until vrfStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: REPLACED - Update existing VRF using replace - delete attachments + cisco.dcnm.dcnm_vrf: &conf1 + fabric: "{{ test_fabric }}" + 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 + tags: sanity + +- name: Query fabric state until vrfStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.vrfStatus is search('NA')" + retries: 30 + delay: 2 + tags: sanity + +- 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.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == false' + - 'result.diff[0].attach[1].deploy == false' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: REPLACED - conf1 - Idempotence + cisco.dcnm.dcnm_vrf: *conf1 + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + tags: sanity + +- name: REPLACED - Update existing VRF using replace - create attachments + cisco.dcnm.dcnm_vrf: &conf2 + fabric: "{{ test_fabric }}" + 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: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + deploy: true + register: result + tags: sanity + +- name: Query fabric state until vrfStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - 'result.diff[0].attach[1].deploy == true' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result.diff[0].attach[0].vlan_id == 500' + - 'result.diff[0].attach[1].vlan_id == 500' + tags: sanity + +- name: REPLACED - conf2 - Idempotence + cisco.dcnm.dcnm_vrf: *conf2 + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + tags: sanity + +- name: REPLACED - Clean up any existing vrfs + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: deleted + tags: sanity + +############################################### +### OVERRIDDEN ## +############################################### + +- name: OVERRIDDEN - Create, Attach and Deploy new VRF - VLAN Provided by the User + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + 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: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + deploy: true + register: result + tags: sanity + +- name: Query fabric state until vrfStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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' + - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address' + - '"{{ ansible_switch2 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: OVERRIDDEN - Update existing VRF using overridden - delete and create + cisco.dcnm.dcnm_vrf: &conf3 + fabric: "{{ test_fabric }}" + 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: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + deploy: true + register: result + tags: sanity + +- name: Query fabric state until vrfStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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.response[4].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[4].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - 'result.diff[0].attach[1].deploy == true' + - 'result.diff[0].vrf_name == "ansible-vrf-int2"' + - 'result.diff[1].attach[0].deploy == false' + - 'result.diff[1].attach[1].deploy == false' + - 'result.diff[1].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: OVERRIDDEN - conf - Idempotence + cisco.dcnm.dcnm_vrf: *conf3 + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + - 'result.response|length == 0' + tags: sanity + +- name: OVERRIDDEN - Clean up any existing vrfs + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: deleted + tags: sanity + +############################################### +### QUERY ## +############################################### + +- name: QUERY - Create, Attach and Deploy new VRF - VLAN Provided by the User + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + 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: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + deploy: true + register: result + tags: sanity + +- name: Query fabric state until vrfStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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' + - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address' + - '"{{ ansible_switch2 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: QUERY - Query the VRF + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: query + 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: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + deploy: true + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + - 'result.response[0].parent.vrfName == "ansible-vrf-int1"' + - 'result.response[0].parent.vrfId == 9008011' + - 'result.response[0].parent.vrfStatus == "DEPLOYED"' + - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[0].switchDetailsList[0].lanAttachedState == "DEPLOYED"' + - 'result.response[0].attach[0].switchDetailsList[0].vlan == 500' + - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[1].switchDetailsList[0].lanAttachedState == "DEPLOYED"' + - 'result.response[0].attach[1].switchDetailsList[0].vlan == 500' + tags: sanity + +- name: QUERY - Clean up existing vrfs + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: deleted + register: result + tags: sanity + +############################################### +### DELETED ## +############################################### + +- name: DELETED - Create, Attach and Deploy new VRF - VLAN Provided by the User + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + 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: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + deploy: true + register: result + tags: sanity + +- name: Query fabric state until vrfStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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' + - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address' + - '"{{ ansible_switch2 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: DELETED - Delete VRF using deleted state + cisco.dcnm.dcnm_vrf: &conf4 + fabric: "{{ test_fabric }}" + 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 + tags: sanity + +- assert: + that: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[1].MESSAGE == "OK"' + - 'result.response[2].RETURN_CODE == 200' + - 'result.response[2].METHOD == "DELETE"' + - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == false' + - 'result.diff[0].attach[1].deploy == false' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: DELETED - conf - Idempotence + cisco.dcnm.dcnm_vrf: *conf4 + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + - 'result.response|length == 0' + tags: sanity + - 'result.diff|length == 0' From af9b22ba009e022cb7db70ec6b4ff78dbbac5c91 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 3 Jul 2023 11:34:00 +0530 Subject: [PATCH 107/248] Create sanity.yml --- .../dcnm_template/tests/dcnm/sanity.yml | 454 ++++++++++++++++++ 1 file changed, 454 insertions(+) create mode 100644 tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml new file mode 100644 index 000000000..f7be2c546 --- /dev/null +++ b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml @@ -0,0 +1,454 @@ +############################################## +## SETUP ## +############################################## + +- name: Initialize the setup + 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: result + +- assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +- block: + +############################################## +## MERGE ## +############################################## + + - name: Create templates + cisco.dcnm.dcnm_template: &temp_merge + state: merged # only choose form [merged, deleted, query] + config: + - name: template_101 + description: "Template_101" + 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" + tags: "internal policy 102" + 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" + tags: "internal policy 103" + content: | + telemetry + certificate /bootflash/telegraf.crt telegraf + destination-profile + use-vrf management + destination-group 3 + ip address 10.195.225.176 port 53000 protocol gRPC encoding GPB + sensor-group 3 + data-source DME + path sys/ch depth unbounded + subscription 3 + dst-grp 3 + snsr-grp 2 sample-interval 30000 + + - name: template_104 + description: "Template_104" + tags: "internal policy 104" + content: | + telemetry + certificate /bootflash/telegraf.crt telegraf + destination-profile + use-vrf management + destination-group 4 + ip address 10.195.224.176 port 54000 protocol gRPC encoding GPB + sensor-group 4 + data-source DME + path sys/ch depth unbounded + 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: Create templates again - Idempotence + cisco.dcnm.dcnm_template: *temp_merge + 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' + + +############################################## +## MODIFY PROPERTIES ## +############################################## + + + - name: Modifying existing templates + cisco.dcnm.dcnm_template: &temp_repl + state: merged # only choose form [merged, deleted, query] + config: + - name: template_101 + description: "Template_101 - added this description" + 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 + 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 + telemetry + certificate /bootflash/telegraf.crt telegraf + destination-profile + use-vrf management + destination-group 10 + ip address 10.195.225.179 port 53010 protocol gRPC encoding GPB + sensor-group 10 + data-source DME + path sys/ch depth unbounded + subscription 10 + dst-grp 10 + snsr-grp 10 sample-interval 30010 + + - name: template_104 # No modifications + description: "Template_104" + tags: "internal policy 104" + content: | + telemetry + certificate /bootflash/telegraf.crt telegraf + destination-profile + use-vrf management + destination-group 4 + ip address 10.195.224.176 port 54000 protocol gRPC encoding GPB + sensor-group 4 + data-source DME + path sys/ch depth unbounded + subscription 4 + dst-grp 4 + snsr-grp 4 sample-interval 40000 + + 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' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + - '"Template Created" in item["DATA"]["status"]' + loop: '{{ result.response }}' + + - name: Modifying existing templates - Idempotence + cisco.dcnm.dcnm_template: *temp_repl + 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' + + + + +############################################## +## NO DELETE ## +############################################## + + - name: Create a template + cisco.dcnm.dcnm_template: &temp_merge + state: merged # only choose form [merged, deleted, query] + config: + - name: template_101 + description: "Template_101" + 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 + + 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' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + - '"Template Created" in item["DATA"]["status"]' + loop: '{{ 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] + config: + - name: template_inuse_1 + - name: template_inuse_2 + - name: template_101 + + register: result + + - assert: + that: + - '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 }}' + + - name: Delete a template which is not existing + cisco.dcnm.dcnm_template: + state: deleted # only choose form [merged, deleted, query] + config: + - name: template_1000 + + register: result + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + + +############################################## +## QUERY ## +############################################## + + - name: Query a template + cisco.dcnm.dcnm_template: + state: query # only choose form [merged, deleted, query] + config: + - name: template_101 + + - name: template_102 + + - name: template_103 + + - name: template_104 + + - name: template_inuse_1 + + 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' + - '"template_inuse_1" in result["template-policy-map"].keys()' + +############################################## +## TEMPLATE VALIDATION FAIL ## +############################################## + + - name: Create templates + cisco.dcnm.dcnm_template: &temp_merge + state: merged # only choose form [merged, deleted, query] + config: + - name: test_fail + description: "test_fail" + tags: "internal template test_fail" + content: | + # Copyright (c) 2018 by Cisco Systems, Inc. + # All rights reserved. + + @(DisplayName="AAA Server Name/IP", Description="Name or IPv4/IPv6 Address of an AAA Server") + ipAddressWithoutPrefix AAA_SERVER; + + @(DisplayName="AAA group", Description="Name of AAA Group") + string AAA_GROUP { + minLength = 1; + maxLength = 127; + }; + aaa group server radius $$AAA_GROUP$$ + server $$AAA_SERVER$$ + register: result + + - 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: set_fact when error found + set_fact: + error_exists: true + loop: "{{ lookup('list', result['response'][0]['DATA']) }}" + when: '"ERROR" == item.get("reportItemType")' + + - assert: + that: + - 'error_exists == true' + +############################################## +## WRONG STATE ## +############################################## + + + - 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: | + 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 + + register: result + ignore_errors: yes + + - assert: + that: + - 'result.changed == false' + - 'result["msg"] == "value of state must be one of: merged, deleted, query, got: replaced"' + + + +############################################## +## DELETED ## +############################################## + + + - 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: template_103 + + - name: template_104 + + register: result + + - 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 + + - assert: + that: + - 'result.changed == false' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' From 53f2e08124fab60b927bceb7175a6fd2fdbd2359 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 3 Jul 2023 11:51:26 +0530 Subject: [PATCH 108/248] Update sanity.yml --- tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml index f7be2c546..4977c2f98 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml @@ -12,10 +12,12 @@ - name: template_104 register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' + tags: sanity loop: '{{ result.response }}' - block: @@ -452,3 +454,5 @@ - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' + + tags: sanity From 030bcffadc87b737510d994c1c7ccf8e65b8f723 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 3 Jul 2023 11:53:49 +0530 Subject: [PATCH 109/248] Update sanity.yml --- tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml index 4977c2f98..2dc6a9d76 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml @@ -17,8 +17,8 @@ - assert: that: - 'item["RETURN_CODE"] == 200' - tags: sanity loop: '{{ result.response }}' + tags: sanity - block: From 0ac34fb7b6d8ab63006605d826c8d3f69b20718d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 3 Jul 2023 12:44:42 +0530 Subject: [PATCH 110/248] Create sanity.yml --- .../dcnm_inventory/tests/dcnm/sanity.yml | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml new file mode 100644 index 000000000..4430cbfac --- /dev/null +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml @@ -0,0 +1,168 @@ +############################################## +## SETUP ## +############################################## + +- set_fact: + rest_path: "/rest/control/fabrics/{{ ansible_it_fabric }}" + when: controller_version == "11" + +- set_fact: + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_it_fabric }}" + when: controller_version >= "12" + +- name: MERGED - Verify if fabric is deployed. + cisco.dcnm.dcnm_rest: + method: GET + path: "{{ rest_path }}" + register: result + +- assert: + that: + - 'result.response.DATA != None' + +- name: MERGED - setup - Clean up any existing devices + cisco.dcnm.dcnm_inventory: + fabric: "{{ ansible_it_fabric }}" + state: deleted + +############################################## +## MERGED ## +############################################## + +- name: MERGED - Merge a Switch using GreenField Deployment + cisco.dcnm.dcnm_inventory: &conf + fabric: "{{ ansible_it_fabric }}" + state: merged + config: + - seed_ip: "{{ ansible_switch1 }}" + 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 # default is Leaf - choose from [Leaf, Spine, Border, Border Spine, Border Gateway, Border Gateway Spine + # Super Spine, Border Super Spine, Border Gateway Super Spine] + preserve_config: False # boolean, default is true + register: result + +- assert: + that: + - 'result.changed == true' + +- assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +- name: MERGED - conf1 - GF - Idempotence + cisco.dcnm.dcnm_inventory: *conf + register: result + +- assert: + that: + - 'result.changed == false' + - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' + +- name: MERGED - setup - Clean up any existing devices + cisco.dcnm.dcnm_inventory: + fabric: "{{ ansible_it_fabric }}" + state: deleted + + +############################################## +## OVERRIDDEN ## +############################################## + +- name: OVERRIDDEN - Update a New Switch using GreenField Deployment - Delete and Create - default role + cisco.dcnm.dcnm_inventory: &conf_over + fabric: "{{ ansible_it_fabric }}" + state: overridden + config: + - seed_ip: "{{ ansible_switch2 }}" + 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 + preserve_config: False # boolean, default is true + register: result + +- assert: + that: + - 'result.changed == true' + +- assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +- name: OVERRIDDEN - conf1 - OV - Idempotence + cisco.dcnm.dcnm_inventory: *conf_over + register: result + +- 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"' + +############################################## +## CLEAN-UP ## +############################################## + +- name: OVERRIDDEN - setup - Clean up any existing devices + cisco.dcnm.dcnm_inventory: + fabric: "{{ ansible_it_fabric }}" + state: deleted + +############################################## +## QUERY ## +############################################## + + +- name: QUERY - Merge a Switch using GreenField Deployment + cisco.dcnm.dcnm_inventory: + fabric: "{{ ansible_it_fabric }}" + state: merged + config: + - seed_ip: "{{ ansible_switch1 }}" + 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 # default is Leaf - choose from [Leaf, Spine, Border, Border Spine, Border Gateway, Border Gateway Spine + # Super Spine, Border Super Spine, Border Gateway Super Spine] + preserve_config: False # boolean, default is true + register: result + +- assert: + that: + - 'result.changed == true' + +- assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + +############################################# +# QUERY ## +############################################# + +- name: QUERY - Query a Switch - Hostname and Role must match + cisco.dcnm.dcnm_inventory: + fabric: "{{ ansible_it_fabric }}" + state: query + config: + - seed_ip: "{{ ansible_switch1 }}" + role: leaf # default is Leaf - choose from [Leaf, Spine, Border, Border Spine, Border Gateway, Border Gateway Spine + # Super Spine, Border Super Spine, Border Gateway Super Spine] + register: result + +- assert: + that: + - 'result.response[0].ipAddress == "{{ ansible_switch1 }}"' + - 'result.response[0].switchRole == "leaf"' + +- name: QUERY - cleanup - Clean up any existing devices + cisco.dcnm.dcnm_inventory: + fabric: "{{ ansible_it_fabric }}" + state: deleted + From 4fc67c6037464daa82b1f2420ef973d8ff19be4e Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 3 Jul 2023 13:10:45 +0530 Subject: [PATCH 111/248] Update sanity.yml --- .../dcnm_inventory/tests/dcnm/sanity.yml | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml index 4430cbfac..c42eab4a7 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml @@ -5,25 +5,30 @@ - set_fact: rest_path: "/rest/control/fabrics/{{ ansible_it_fabric }}" when: controller_version == "11" + tags: sanity - set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_it_fabric }}" when: controller_version >= "12" + tags: sanity - name: MERGED - Verify if fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" register: result + tags: sanity - assert: that: - 'result.response.DATA != None' + tags: sanity - name: MERGED - setup - Clean up any existing devices cisco.dcnm.dcnm_inventory: fabric: "{{ ansible_it_fabric }}" state: deleted + tags: sanity ############################################## ## MERGED ## @@ -43,29 +48,35 @@ # Super Spine, Border Super Spine, Border Gateway Super Spine] preserve_config: False # boolean, default is true register: result + tags: sanity - assert: that: - 'result.changed == true' + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: MERGED - conf1 - GF - Idempotence cisco.dcnm.dcnm_inventory: *conf register: result + tags: sanity - assert: that: - 'result.changed == false' - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' + tags: sanity - name: MERGED - setup - Clean up any existing devices cisco.dcnm.dcnm_inventory: fabric: "{{ ansible_it_fabric }}" state: deleted + tags: sanity ############################################## @@ -84,24 +95,29 @@ max_hops: 0 preserve_config: False # boolean, default is true register: result + tags: sanity - assert: that: - 'result.changed == true' + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: OVERRIDDEN - conf1 - OV - Idempotence cisco.dcnm.dcnm_inventory: *conf_over register: result + tags: sanity - 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"' + tags: sanity ############################################## ## CLEAN-UP ## @@ -111,7 +127,7 @@ cisco.dcnm.dcnm_inventory: fabric: "{{ ansible_it_fabric }}" state: deleted - + tags: sanity ############################################## ## QUERY ## ############################################## @@ -131,15 +147,18 @@ # Super Spine, Border Super Spine, Border Gateway Super Spine] preserve_config: False # boolean, default is true register: result + tags: sanity - assert: that: - 'result.changed == true' + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity ############################################# @@ -155,14 +174,17 @@ role: leaf # default is Leaf - choose from [Leaf, Spine, Border, Border Spine, Border Gateway, Border Gateway Spine # Super Spine, Border Super Spine, Border Gateway Super Spine] register: result + tags: sanity - assert: that: - 'result.response[0].ipAddress == "{{ ansible_switch1 }}"' - 'result.response[0].switchRole == "leaf"' + tags: sanity - name: QUERY - cleanup - Clean up any existing devices cisco.dcnm.dcnm_inventory: fabric: "{{ ansible_it_fabric }}" state: deleted + tags: sanity From a2dd705f84c130d569b071cf360e525b1fdf0599 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 3 Jul 2023 13:27:23 +0530 Subject: [PATCH 112/248] Create sanity.yml --- .../dcnm_network/tests/dcnm/sanity.yml | 715 ++++++++++++++++++ 1 file changed, 715 insertions(+) create mode 100644 tests/integration/targets/dcnm_network/tests/dcnm/sanity.yml diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yml new file mode 100644 index 000000000..6ef11e84d --- /dev/null +++ b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yml @@ -0,0 +1,715 @@ +############################################## +## SETUP ## +############################################## + +- set_fact: + rest_path: "/rest/control/fabrics/{{ test_fabric }}" + when: controller_version == "11" + tags: sanity + +- set_fact: + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" + when: controller_version >= "12" + tags: sanity + +- name: MERGED - Verify if fabric - Fabric1 is deployed. + cisco.dcnm.dcnm_rest: + method: GET + path: "{{ rest_path }}" + register: result + tags: sanity + +- assert: + that: + - 'result.response.DATA != None' + tags: sanity + +- name: MERGED - setup - Clean up any existing networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: deleted + tags: sanity + +############################################## +## MERGED ## +############################################## + +- name: MERGED - Create New Network without Deploy + cisco.dcnm.dcnm_network: + fabric: "{{ test_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' + deploy: False + register: result + tags: sanity + +- name: Query fabric for creation of Network Object + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.displayName is search('ansible-net13')" + - "query_result.response[0].parent.networkId is search('7005')" + - "query_result.response[0].parent.vrf is search('Tenant-1')" + retries: 5 + delay: 2 + tags: sanity + +- assert: + that: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.diff[0].attach|length == 0' + - 'result.diff[0].net_name == "ansible-net13"' + - 'result.diff[0].net_id == 7005' + - 'result.diff[0].vrf_name == "Tenant-1"' + tags: sanity + +- name: MERGED - setup - Clean up any existing networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: deleted + tags: sanity + + + + + + + + +- name: OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach + cisco.dcnm.dcnm_network: + fabric: "{{ test_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: "{{ ansible_switch1 }}" + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] + deploy: true + - ip_address: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int3 }}", "{{ ansible_sw2_int4 }}"] + 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: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] + deploy: true + deploy: false + register: result + tags: sanity + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED')" + - "query_result.response[1].parent.networkStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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[2].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[2].DATA|dict2items)[1].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-net13"' + - 'result.diff[0].net_id == 7005' + - 'result.diff[0].vrf_name == "Tenant-1"' + - 'result.diff[1].attach[0].deploy == true' + - '"{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address' + - 'result.diff[1].net_name == "ansible-net12"' + - 'result.diff[1].net_id == 7002' + - 'result.diff[1].vrf_name == "Tenant-2"' + tags: sanity + +############################################## +## OVERRIDDEN ## +############################################## + +- name: OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach + cisco.dcnm.dcnm_network: &conf1 + fabric: "{{ test_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: "{{ ansible_switch1 }}" + # Replace the ports with new ports + # ports: [Ethernet1/1, Ethernet1/2] + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int4 }}"] + deploy: true + # delete the second network + deploy: false + register: result + tags: sanity + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[4].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[4].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.response[3].METHOD == "DELETE"' + - 'result.diff[0].attach[0].deploy == false' + - 'result.diff[0].attach[1].deploy == true' + - 'result.diff[0].attach[2].deploy == false' + - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address' + - '"{{ ansible_switch1 }}" in result.diff[0].attach[1].ip_address' + - '"{{ ansible_switch2 }}" in result.diff[0].attach[2].ip_address' + - 'result.diff[0].net_name == "ansible-net13"' + - 'result.diff[0].net_id == 7005' + - 'result.diff[0].vrf_name == "Tenant-1"' + - 'result.diff[1].attach[0].deploy == false' + - '"{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address' + - 'result.diff[1].net_name == "ansible-net12"' + tags: sanity + +- name: OVERRIDDEN - conf1 - Idempotence + cisco.dcnm.dcnm_network: *conf1 + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + - 'result.response|length == 0' + tags: sanity + +- name: OVERRIDDEN - setup - remove any networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: deleted + tags: sanity + + + + + + + + + + +- name: Setup - Clean up any existing networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: deleted + register: result + until: + - "result.response | length == 0" + retries: 30 + delay: 2 + tags: sanity + +- name: Create, Attach and Deploy Multiple Network with Single Switch Attach + cisco.dcnm.dcnm_network: + fabric: "{{ test_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: "{{ ansible_switch1 }}" + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] + 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: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int1 }}", "{{ ansible_sw2_int2 }}"] + deploy: true + deploy: false + register: result + tags: sanity + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED')" + - "query_result.response[1].parent.networkStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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[2].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[2].DATA|dict2items)[1].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-net13"' + - 'result.diff[0].net_id == 7005' + - 'result.diff[0].vrf_name | regex_search("Tenant-[1|2]", ignorecase=True)' + - 'result.diff[1].attach[0].deploy == true' + - '"{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address' + - 'result.diff[1].net_name == "ansible-net12"' + - 'result.diff[1].net_id == 7002' + - 'result.diff[1].vrf_name | regex_search("Tenant-[1|2]", ignorecase=True)' + tags: sanity + +############################################### +### QUERY ## +############################################### + +- name: QUERY - Query the Network + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: query + 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' + - 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' + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + - 'result.response[0].parent.networkName == "ansible-net13"' + - 'result.response[0].parent.networkId | regex_search("700[2|5]", ignorecase=True)' + - 'result.response[0].parent.networkTemplate == "Default_Network_Universal"' + - 'result.response[0].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)' + - 'result.response[0].attach[0].isLanAttached== true' + - 'result.response[0].attach[0].lanAttachState== "DEPLOYED"' + - 'result.response[0].attach[0].networkName== "ansible-net13"' + - 'result.response[0].attach[1].isLanAttached== false' + - 'result.response[0].attach[1].lanAttachState== "NA"' + - 'result.response[0].attach[1].networkName== "ansible-net13"' + - 'result.response[1].parent.networkName == "ansible-net12"' + - 'result.response[1].parent.networkId | regex_search("700[2|5]", ignorecase=True)' + - 'result.response[1].parent.networkTemplate == "Default_Network_Universal"' + - 'result.response[1].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)' + - 'result.response[1].attach[0].isLanAttached== true' + - 'result.response[1].attach[0].lanAttachState== "DEPLOYED"' + - 'result.response[1].attach[0].networkName== "ansible-net12"' + - 'result.response[1].attach[1].isLanAttached== false' + - 'result.response[1].attach[1].lanAttachState== "NA"' + - 'result.response[1].attach[1].networkName== "ansible-net12"' + tags: sanity + +- name: QUERY - Query the Network without the config element + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: query + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + - 'result.response[0].parent.networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' + - 'result.response[0].parent.networkId | regex_search("700[2|5]", ignorecase=True)' + - 'result.response[0].parent.networkTemplate == "Default_Network_Universal"' + - 'result.response[0].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)' + - 'result.response[0].attach[0].isLanAttached== true' + - 'result.response[0].attach[0].lanAttachState== "DEPLOYED"' + - 'result.response[0].attach[0].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' + - 'result.response[0].attach[1].isLanAttached== false' + - 'result.response[0].attach[1].lanAttachState== "NA"' + - 'result.response[0].attach[1].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' + - 'result.response[1].parent.networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' + - 'result.response[1].parent.networkId | regex_search("700[2|5]", ignorecase=True)' + - 'result.response[1].parent.networkTemplate == "Default_Network_Universal"' + - 'result.response[1].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)' + - 'result.response[1].attach[0].isLanAttached== true' + - 'result.response[1].attach[0].lanAttachState== "DEPLOYED"' + - 'result.response[1].attach[0].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' + - 'result.response[1].attach[1].isLanAttached== false' + - 'result.response[1].attach[1].lanAttachState== "NA"' + - 'result.response[1].attach[1].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' + tags: sanity + + +- name: Delete all the networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: deleted + register: result + tags: sanity + +- name: Query fabric state until all networks are deleted + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response | length == 0" + retries: 30 + delay: 2 + tags: sanity + +- 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[0].MESSAGE == "OK"' + - 'result.response[1].MESSAGE == "OK"' + - 'result.response[2].MESSAGE == "OK"' + - 'result.response[3].MESSAGE == "OK"' + - 'result.response[3].METHOD == "DELETE"' + - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == false' + - 'result.diff[1].attach[0].deploy == false' + - '"{{ ansible_switch1 }}" or "{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[1].attach[0].ip_address' + - '"ansible-net13" or "ansible-net12" in result.diff[1].net_name' + - '"ansible-net13" or "ansible-net12" in result.diff[0].net_name' + tags: sanity + + + + + + + + + + + + +- name: REPLACED - Create, Attach and Deploy Multiple Network with Single Switch Attach + cisco.dcnm.dcnm_network: + fabric: "{{ test_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: "{{ ansible_switch1 }}" + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] + deploy: true + - ip_address: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int3 }}", "{{ ansible_sw2_int4 }}"] + 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: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] + deploy: true + deploy: false + register: result + tags: sanity + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED')" + - "query_result.response[1].parent.networkStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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[2].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[2].DATA|dict2items)[1].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-net13"' + - 'result.diff[0].net_id == 7005' + - 'result.diff[0].vrf_name == "Tenant-1"' + - 'result.diff[1].attach[0].deploy == true' + - '"{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address' + - 'result.diff[1].net_name == "ansible-net12"' + - 'result.diff[1].net_id == 7002' + - 'result.diff[1].vrf_name == "Tenant-2"' + tags: sanity + +############################################## +## REPLACED ## +############################################## + +- name: REPLACED - Update Network using replace - Delete Attachments + cisco.dcnm.dcnm_network: &conf1 + fabric: "{{ test_fabric }}" + state: replaced + 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' + - 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: true + register: result + tags: sanity + +- name: Query fabric state until networkStatus transitions to NA state + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('NA')" + - "query_result.response[1].parent.networkStatus is search('NA')" + retries: 30 + delay: 2 + tags: sanity + +- 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.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - '(result.response[0].DATA|dict2items)[2].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == false' + - 'result.diff[0].attach[1].deploy == false' + - '"{{ ansible_switch1 }}" or "{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address' + - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[1].attach[1].ip_address' + - '"ansible-net13" or "ansible-net12" in result.diff[1].net_name' + - 'result.diff[1].attach[0].deploy == false' + - '"{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address' + - '"ansible-net13" or "ansible-net12" in result.diff[0].net_name' + tags: sanity + +- name: REPLACED - conf1 - Idempotence + cisco.dcnm.dcnm_network: *conf1 + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + - 'result.response|length == 0' + tags: sanity + + + + + + + + + + + + + + + + + + + + + +- name: DELETED - setup - Clean up any existing networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: deleted + tags: sanity + +- name: DELETED - Create, Attach and Deploy Single Network with multiple switch Attach + cisco.dcnm.dcnm_network: + fabric: "{{ test_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: "{{ ansible_switch1 }}" + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] + deploy: true + - ip_address: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] + deploy: true + deploy: false + register: result + tags: sanity + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + tags: sanity + +- 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' + - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address' + - 'result.diff[0].attach[1].deploy == true' + - '"{{ ansible_switch2 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].net_name == "ansible-net13"' + - 'result.diff[0].net_id == 7005' + - 'result.diff[0].vrf_name == "Tenant-1"' + tags: sanity + +############################################### +### DELETED ## +############################################### + +- name: DELETED - Delete Single Network with deleted state + cisco.dcnm.dcnm_network: &conf + fabric: "{{ test_fabric }}" + state: deleted + 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' + register: result + tags: sanity + +- 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].MESSAGE == "OK"' + - 'result.response[1].MESSAGE == "OK"' + - 'result.response[2].MESSAGE == "OK"' + - 'result.response[2].METHOD == "DELETE"' + - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == false' + - 'result.diff[0].attach[1].deploy == false' + - '"{{ ansible_switch1 }}" or "{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].net_name == "ansible-net13"' + tags: sanity + +- name: DELETED - conf - Idempotence + cisco.dcnm.dcnm_network: *conf + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + - 'result.response|length == 0' + - 'result.diff|length == 0' From 99c2896cc0eb076604dd1dd23abfdcb78d6d92d7 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 4 Jul 2023 12:38:46 +0530 Subject: [PATCH 113/248] Update sanity.yml --- .../targets/dcnm_template/tests/dcnm/sanity.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml index 2dc6a9d76..5fb352aa9 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml @@ -226,14 +226,25 @@ - '(result["diff"][0]["query"] | length) == 0' +############################################## +## CLEANUP ## +############################################## +- name: Initialize the setup + 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 ############################################## ## NO DELETE ## ############################################## - name: Create a template - cisco.dcnm.dcnm_template: &temp_merge + cisco.dcnm.dcnm_template: &temp_merge2 state: merged # only choose form [merged, deleted, query] config: - name: template_101 From 93bedcec5f7575f1d949453da21b67721db06b53 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 4 Jul 2023 14:33:58 +0530 Subject: [PATCH 114/248] Update sanity.yml --- .../dcnm_inventory/tests/dcnm/sanity.yml | 85 +++++-------------- 1 file changed, 23 insertions(+), 62 deletions(-) diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml index c42eab4a7..1dcff4f0d 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml @@ -72,12 +72,33 @@ - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' tags: sanity -- name: MERGED - setup - Clean up any existing devices +############################################# +# QUERY ## +############################################# + +- name: QUERY - Query a Switch - Hostname and Role must match cisco.dcnm.dcnm_inventory: fabric: "{{ ansible_it_fabric }}" - state: deleted + state: query + config: + - seed_ip: "{{ ansible_switch1 }}" + role: leaf # default is Leaf - choose from [Leaf, Spine, Border, Border Spine, Border Gateway, Border Gateway Spine + # Super Spine, Border Super Spine, Border Gateway Super Spine] + register: result tags: sanity +- assert: + that: + - 'result.response[0].ipAddress == "{{ ansible_switch1 }}"' + - 'result.response[0].switchRole == "leaf"' + tags: sanity + +- name: QUERY - cleanup - Clean up any existing devices + cisco.dcnm.dcnm_inventory: + fabric: "{{ ansible_it_fabric }}" + state: deleted + tags: sanity + ############################################## ## OVERRIDDEN ## @@ -128,63 +149,3 @@ fabric: "{{ ansible_it_fabric }}" state: deleted tags: sanity -############################################## -## QUERY ## -############################################## - - -- name: QUERY - Merge a Switch using GreenField Deployment - cisco.dcnm.dcnm_inventory: - fabric: "{{ ansible_it_fabric }}" - state: merged - config: - - seed_ip: "{{ ansible_switch1 }}" - 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 # default is Leaf - choose from [Leaf, Spine, Border, Border Spine, Border Gateway, Border Gateway Spine - # Super Spine, Border Super Spine, Border Gateway Super Spine] - preserve_config: False # boolean, default is true - register: result - tags: sanity - -- assert: - that: - - 'result.changed == true' - tags: sanity - -- assert: - that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - tags: sanity - - -############################################# -# QUERY ## -############################################# - -- name: QUERY - Query a Switch - Hostname and Role must match - cisco.dcnm.dcnm_inventory: - fabric: "{{ ansible_it_fabric }}" - state: query - config: - - seed_ip: "{{ ansible_switch1 }}" - role: leaf # default is Leaf - choose from [Leaf, Spine, Border, Border Spine, Border Gateway, Border Gateway Spine - # Super Spine, Border Super Spine, Border Gateway Super Spine] - register: result - tags: sanity - -- assert: - that: - - 'result.response[0].ipAddress == "{{ ansible_switch1 }}"' - - 'result.response[0].switchRole == "leaf"' - tags: sanity - -- name: QUERY - cleanup - Clean up any existing devices - cisco.dcnm.dcnm_inventory: - fabric: "{{ ansible_it_fabric }}" - state: deleted - tags: sanity - From 7ec49a70629998eddbdbe0236e39d68aebc18782 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:15:18 +0530 Subject: [PATCH 115/248] Update sanity.yml --- .../dcnm_inventory/tests/dcnm/sanity.yml | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml index 1dcff4f0d..c8e680b31 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml @@ -24,11 +24,6 @@ - 'result.response.DATA != None' tags: sanity -- name: MERGED - setup - Clean up any existing devices - cisco.dcnm.dcnm_inventory: - fabric: "{{ ansible_it_fabric }}" - state: deleted - tags: sanity ############################################## ## MERGED ## @@ -39,7 +34,7 @@ fabric: "{{ ansible_it_fabric }}" state: merged config: - - seed_ip: "{{ ansible_switch1 }}" + - seed_ip: "{{ ansible_switch3 }}" auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] user_name: "{{ switch_username }}" password: "{{ switch_password }}" @@ -81,7 +76,7 @@ fabric: "{{ ansible_it_fabric }}" state: query config: - - seed_ip: "{{ ansible_switch1 }}" + - seed_ip: "{{ ansible_switch3 }}" role: leaf # default is Leaf - choose from [Leaf, Spine, Border, Border Spine, Border Gateway, Border Gateway Spine # Super Spine, Border Super Spine, Border Gateway Super Spine] register: result @@ -93,11 +88,6 @@ - 'result.response[0].switchRole == "leaf"' tags: sanity -- name: QUERY - cleanup - Clean up any existing devices - cisco.dcnm.dcnm_inventory: - fabric: "{{ ansible_it_fabric }}" - state: deleted - tags: sanity ############################################## @@ -109,7 +99,7 @@ fabric: "{{ ansible_it_fabric }}" state: overridden config: - - seed_ip: "{{ ansible_switch2 }}" + - seed_ip: "{{ ansible_switch4 }}" auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] user_name: "{{ switch_username }}" password: "{{ switch_password }}" @@ -144,8 +134,21 @@ ## CLEAN-UP ## ############################################## -- name: OVERRIDDEN - setup - Clean up any existing devices - cisco.dcnm.dcnm_inventory: +- name: DELETED - setup - Clean up any existing devices + cisco.dcnm.dcnm_inventory: &clean fabric: "{{ ansible_it_fabric }}" state: deleted + config: + - seed_ip: "{{ ansible_switch4 }}" + 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 + preserve_config: False # boolean, default is true + register: result + tags: sanity + +- name: DELETED - conf1 - OV - Idempotence + cisco.dcnm.dcnm_inventory: *clean + register: result tags: sanity From 3bcc7504a440a1470534bee1d59ba91548b2cc12 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 5 Jul 2023 10:08:27 +0530 Subject: [PATCH 116/248] Updated config.yml --- .circleci/config.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 41e42626b..fc0a16e38 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -224,10 +224,10 @@ workflows: matrix: parameters: ansible_version: - # - 2.9.26 - # - 2.10.17 - # - 2.11.12 - # - 2.12.10 + - 2.9.26 + - 2.10.17 + - 2.11.12 + - 2.12.10 - 2.13.8 # - 2.14.2 @@ -302,7 +302,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 @@ -327,7 +327,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 # - interface_job inventory: when: @@ -350,7 +350,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 # - inventory_job vrf: when: @@ -373,7 +373,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 links: when: or: @@ -395,7 +395,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 network: when: or: @@ -417,7 +417,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 policy: when: or: @@ -438,7 +438,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 resource_manager: when: @@ -461,7 +461,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 service_node: when: @@ -484,7 +484,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 service_policy: when: @@ -507,7 +507,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 service_route_peering: @@ -531,7 +531,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 template: when: @@ -554,7 +554,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 rest: when: @@ -577,7 +577,7 @@ workflows: - 2.11.12 - 2.12.10 - 2.13.8 - - 2.14.2 + # - 2.14.2 From dd3701b37a017babeb5ea8b4a298680d27fee833 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 5 Jul 2023 10:21:34 +0530 Subject: [PATCH 117/248] Updated config.yml --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fc0a16e38..86ac5f06b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -155,7 +155,7 @@ jobs: export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" echo $PATH echo $PYTHONPATH - coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py + coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py -vvvv - run: name: Run sanity tests py << parameters.py_version >> for << parameters.modulename >> @@ -213,7 +213,7 @@ jobs: command: | export PATH="/home/circleci/.ansible/collections/:$PATH" export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" - coverage run --source=. -m pytest tests/unit/modules/dcnm/. + coverage run --source=. -m pytest tests/unit/modules/dcnm/. -vvvv workflows: @@ -500,7 +500,7 @@ workflows: - "3.8" - "3.9" modulename: - - service_policy_job + - service_policy ansible_version: - 2.9.26 - 2.10.17 From 73939ca0e6b2834c7c65f2c42815f3872086f64a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 5 Jul 2023 10:24:56 +0530 Subject: [PATCH 118/248] Create sanity.yml --- .../dcnm_interface/tests/dcnm/sanity.yml | 1228 +++++++++++++++++ 1 file changed, 1228 insertions(+) create mode 100644 tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yml diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yml new file mode 100644 index 000000000..964a47815 --- /dev/null +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yml @@ -0,0 +1,1228 @@ +## eth + +############################################## +## SETUP ## +############################################## + +- name: Remove local log file + local_action: command rm -f dcnm_intf.log + +- name: Put the fabric to default state + cisco.dcnm.dcnm_interface: + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: overridden # only choose form [merged, replaced, deleted, overridden, query] + register: result + +- assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +- block: + +############################################## +## MERGE ## +############################################## + + - name: Create ethernet interfaces + cisco.dcnm.dcnm_interface: ð_merge + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: merged # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: "{{ ansible_eth_intf7 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: trunk # choose from [trunk, access, routed, monitor, epl_routed] + speed: 'Auto' # choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + 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] + cmds: # Freeform config + - no shutdown + description: "eth interface acting as trunk" + + - name: "{{ ansible_eth_intf8 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: access # choose from [trunk, access, routed, monitor, epl_routed] + speed: 'Auto' # choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + bpdu_guard: true # choose from [true, false, 'no'] + port_type_fast: true # choose from [true, false] + mtu: default # choose from [default, jumbo] + access_vlan: 31 # + cmds: # Freeform config + - no shutdown + description: "eth interface acting as access" + + - name: "{{ ansible_eth_intf9 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: routed # choose from [trunk, access, routed, monitor, epl_routed] + speed: 'Auto' # choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + int_vrf: "" # VRF name + ipv4_addr: 192.168.1.1 # ipv4 address for the interface + ipv4_mask_len: 24 # ipv4 mask len, choose between [min:1, max:31] + route_tag: "" # Routing Tag for the interface + mtu: 9216 # choose from [min=576, max=9216] + cmds: + - no shutdown + description: "eth interface acting as routed" + + - name: "{{ ansible_eth_intf10 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: epl_routed # choose from [trunk, access, routed, monitor, epl_routed] + speed: 'Auto' # choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + int_vrf: "" # VRF name + ipv4_addr: 192.168.2.1 # ipv4 address for the interface + ipv4_mask_len: 24 # ipv4 mask len, choose between [min:1, max:31] + ipv6_addr: fd05::0102 # ipV6 address for the interface + ipv6_mask_len: 64 # ipv6 mask len, choose between [min:64, max:127] + route_tag: "" # Routing Tag for the interface + mtu: 9216 # choose from [min=576, max=9216] + cmds: + - no shutdown + description: "eth interface acting as epl_routed" + + - name: "{{ ansible_eth_intf11 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + mode: monitor # choose from [trunk, access, routed, monitor, epl_routed] + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) <= 5' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["replaced"] | length) == 0' + - '(result["diff"][0]["overridden"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 4' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## REPLACE ## +############################################## + + - name: Replace ethernet interfaces + cisco.dcnm.dcnm_interface: ð_replace + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: replaced # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: "{{ ansible_eth_intf7 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: trunk # choose from [trunk, access, routed, monitor, epl_routed] + speed: '1Gb' ## choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + bpdu_guard: 'no' ## choose from [true, false, 'no'] + port_type_fast: false ## choose from [true, false] + mtu: default ## choose from [default, jumbo] + allowed_vlans: all ## choose from [none, all, vlan range] + cmds: # Freeform config + - no shutdown + description: "eth interface acting as trunk - replace" + + - name: "{{ ansible_eth_intf8 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: access # choose from [trunk, access, l3, monitor, epl_routed] + speed: '1Gb' ## choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + bpdu_guard: false ## choose from [true, false, 'no'] + port_type_fast: false ## choose from [true, false] + mtu: jumbo ## choose from [default, jumbo] + access_vlan: 32 ## + cmds: # Freeform config + - no shutdown + description: "eth interface acting as access - replace" + + - name: "{{ ansible_eth_intf9 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: routed # choose from [trunk, access, routed, monitor, epl_routed] + speed: '1Gb' ## choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + int_vrf: "" # VRF name + ipv4_addr: 192.168.3.1 # ipv4 address for the interface + ipv4_mask_len: 24 # ipv4 mask len, choose between [min:1, max:31] + route_tag: "" # Routing Tag for the interface + mtu: 576 ## choose from [min=576, max=9216] + cmds: + - no shutdown + description: "eth interface acting as routed - replace" + + - name: "{{ ansible_eth_intf10 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: epl_routed # choose from [trunk, access, routed, monitor, epl_routed] + speed: '1Gb' ## choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + int_vrf: "" # VRF name + ipv4_addr: 192.168.4.1 # ipv4 address for the interface + ipv4_mask_len: 24 # ipv4 mask len, choose between [min:1, max:31] + ipv6_addr: fd05::0104 # ipV6 address for the interface + ipv6_mask_len: 64 # ipv6 mask len, choose between [min:64, max:127] + route_tag: "" # Routing Tag for the interface + mtu: 576 ## choose from [min=576, max=9216] + cmds: + - no shutdown + description: "eth interface acting as epl_routed - replace" + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["replaced"] | length) == 4' + - '(result["diff"][0]["overridden"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 4' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + - name: Replace ethernet interfaces - Idempotence + cisco.dcnm.dcnm_interface: *eth_replace + register: result + + - 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: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## CLEANUP ## +############################################## + + always: + + - name: Put fabric to default state + cisco.dcnm.dcnm_interface: + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: overridden # only choose form [merged, replaced, deleted, overridden, query] + register: result + when: IT_CONTEXT is not defined + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: IT_CONTEXT is not defined + + + + + +## LO + + +############################################## +## MERGE ## +############################################## + + - name: Create ethernet interfaces + cisco.dcnm.dcnm_interface: ð_merge + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: merged # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: "{{ ansible_eth_intf7 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: trunk # choose from [trunk, access, routed, monitor, epl_routed] + speed: 'Auto' # choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + 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] + cmds: # Freeform config + - no shutdown + description: "eth interface acting as trunk" + + - name: "{{ ansible_eth_intf8 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: access # choose from [trunk, access, routed, monitor, epl_routed] + speed: 'Auto' # choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + bpdu_guard: true # choose from [true, false, 'no'] + port_type_fast: true # choose from [true, false] + mtu: default # choose from [default, jumbo] + access_vlan: 31 # + cmds: # Freeform config + - no shutdown + description: "eth interface acting as access" + + - name: "{{ ansible_eth_intf9 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: routed # choose from [trunk, access, routed, monitor, epl_routed] + speed: 'Auto' # choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + int_vrf: "" # VRF name + ipv4_addr: 192.168.1.1 # ipv4 address for the interface + ipv4_mask_len: 24 # ipv4 mask len, choose between [min:1, max:31] + route_tag: "" # Routing Tag for the interface + mtu: 9216 # choose from [min=576, max=9216] + cmds: + - no shutdown + description: "eth interface acting as routed" + + - name: "{{ ansible_eth_intf10 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: epl_routed # choose from [trunk, access, routed, monitor, epl_routed] + speed: 'Auto' # choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + int_vrf: "" # VRF name + ipv4_addr: 192.168.2.1 # ipv4 address for the interface + ipv4_mask_len: 24 # ipv4 mask len, choose between [min:1, max:31] + ipv6_addr: fd05::0102 # ipV6 address for the interface + ipv6_mask_len: 64 # ipv6 mask len, choose between [min:64, max:127] + route_tag: "" # Routing Tag for the interface + mtu: 9216 # choose from [min=576, max=9216] + cmds: + - no shutdown + description: "eth interface acting as epl_routed" + + - name: "{{ ansible_eth_intf11 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + mode: monitor # choose from [trunk, access, routed, monitor, epl_routed] + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) <= 5' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["replaced"] | length) == 0' + - '(result["diff"][0]["overridden"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 4' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## REPLACE ## +############################################## + + - name: Replace ethernet interfaces + cisco.dcnm.dcnm_interface: ð_replace + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: replaced # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: "{{ ansible_eth_intf7 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: trunk # choose from [trunk, access, routed, monitor, epl_routed] + speed: '1Gb' ## choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + bpdu_guard: 'no' ## choose from [true, false, 'no'] + port_type_fast: false ## choose from [true, false] + mtu: default ## choose from [default, jumbo] + allowed_vlans: all ## choose from [none, all, vlan range] + cmds: # Freeform config + - no shutdown + description: "eth interface acting as trunk - replace" + + - name: "{{ ansible_eth_intf8 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: access # choose from [trunk, access, l3, monitor, epl_routed] + speed: '1Gb' ## choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + bpdu_guard: false ## choose from [true, false, 'no'] + port_type_fast: false ## choose from [true, false] + mtu: jumbo ## choose from [default, jumbo] + access_vlan: 32 ## + cmds: # Freeform config + - no shutdown + description: "eth interface acting as access - replace" + + - name: "{{ ansible_eth_intf9 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: routed # choose from [trunk, access, routed, monitor, epl_routed] + speed: '1Gb' ## choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + int_vrf: "" # VRF name + ipv4_addr: 192.168.3.1 # ipv4 address for the interface + ipv4_mask_len: 24 # ipv4 mask len, choose between [min:1, max:31] + route_tag: "" # Routing Tag for the interface + mtu: 576 ## choose from [min=576, max=9216] + cmds: + - no shutdown + description: "eth interface acting as routed - replace" + + - name: "{{ ansible_eth_intf10 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: epl_routed # choose from [trunk, access, routed, monitor, epl_routed] + speed: '1Gb' ## choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + int_vrf: "" # VRF name + ipv4_addr: 192.168.4.1 # ipv4 address for the interface + ipv4_mask_len: 24 # ipv4 mask len, choose between [min:1, max:31] + ipv6_addr: fd05::0104 # ipV6 address for the interface + ipv6_mask_len: 64 # ipv6 mask len, choose between [min:64, max:127] + route_tag: "" # Routing Tag for the interface + mtu: 576 ## choose from [min=576, max=9216] + cmds: + - no shutdown + description: "eth interface acting as epl_routed - replace" + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["replaced"] | length) == 4' + - '(result["diff"][0]["overridden"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 4' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + - name: Replace ethernet interfaces - Idempotence + cisco.dcnm.dcnm_interface: *eth_replace + register: result + + - 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: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## CLEANUP ## +############################################## + + always: + + - name: Put fabric to default state + cisco.dcnm.dcnm_interface: + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: overridden # only choose form [merged, replaced, deleted, overridden, query] + register: result + when: IT_CONTEXT is not defined + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: IT_CONTEXT is not defined + + + +## pc + + +############################################## +## MERGE ## +############################################## + + - name: Create port channel interfaces + cisco.dcnm.dcnm_interface: &pc_merge + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: merged # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: po300 # should be of the form po + type: pc # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: trunk # choose from [trunk, access, l3, monitor] + members: # member interfaces + - "{{ ansible_eth_intf13 }}" + pc_mode: 'on' # choose from ['on', 'active', 'passive'] + 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] + cmds: # Freeform config + - no shutdown + description: "port channel acting as trunk" + + - name: po301 # should be of the form po + type: pc # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: access # choose from [trunk, access, l3, monitor] + members: # member interfaces + - "{{ ansible_eth_intf14 }}" + pc_mode: 'on' # choose from ['on', 'active', 'passive'] + bpdu_guard: true # choose from [true, false, no] + port_type_fast: true # choose from [true, false] + mtu: default # choose from [default, jumbo] + access_vlan: 301 # + cmds: # Freeform config + - no shutdown + description: "port channel acting as access" + + - name: po302 # should be of the form po + type: pc # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: l3 # choose from [trunk, access, l3, monitor] + members: # member interfaces + - "{{ ansible_eth_intf15 }}" + pc_mode: 'on' # choose from ['on', 'active', 'passive'] + mtu: 9216 # choose between [min=576, max=9216] + int_vrf: "" # interface VRF + ipv4_addr: 192.168.20.1 # ipv4 address for the interface + ipv4_mask_len: 24 # choose between [min:1, max:31] + route_tag: "" # Route Tag + cmds: # Freeform config + - no shutdown + description: "port channel acting as l3" + + - name: po303 # should be of the form po + type: pc # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + mode: monitor # choose from [trunk, access, l3, monitor] + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 4' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["replaced"] | length) == 0' + - '(result["diff"][0]["overridden"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 3' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## REPLACE ## +############################################## + + - name: Replace port channel interfaces + cisco.dcnm.dcnm_interface: &pc_replace + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: replaced # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: po300 # should be of the form po + type: pc # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: trunk # choose from [trunk, access, l3, monitor] + members: # member interfaces + - "{{ ansible_eth_intf13 }}" + pc_mode: 'active' ## choose from ['on', 'active', 'passive'] + bpdu_guard: false ## choose from [true, false, no] + port_type_fast: false ## choose from [true, false] + mtu: default ## choose from [default, jumbo] + allowed_vlans: all ## choose from [none, all, vlan range] + cmds: # Freeform config + - no shutdown + description: "port channel acting as trunk - replace" + + - name: po301 # should be of the form po + type: pc # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: access # choose from [trunk, access, l3, monitor] + members: # member interfaces + - "{{ ansible_eth_intf14 }}" + pc_mode: 'passive' ## choose from ['on', 'active', 'passive'] + bpdu_guard: false ## choose from [true, false, no] + port_type_fast: false ## choose from [true, false] + mtu: jumbo # choose from [default, jumbo] + access_vlan: 110 # + cmds: # Freeform config + - no shutdown + description: "port channel acting as access - replace" + + - name: po302 # should be of the form po + type: pc # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: l3 # choose from [trunk, access, l3, monitor] + members: # member interfaces + - "{{ ansible_eth_intf15 }}" + pc_mode: 'active' ## choose from ['on', 'active', 'passive'] + mtu: 576 ## choose between [min=576, max=9216] + int_vrf: "" # interface VRF + ipv4_addr: 192.169.21.1 # ipv4 address for the interface + ipv4_mask_len: 24 # choose between [min:1, max:31] + route_tag: "" # Route Tag + cmds: + - no shutdown + description: "port channel acting as l3 - replace" + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["replaced"] | length) == 3' + - '(result["diff"][0]["overridden"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 3' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + - name: Replace port channel interfaces - Idempotence + cisco.dcnm.dcnm_interface: *pc_replace + register: result + + - 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: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## CLEANUP ## +############################################## + + always: + + - name: Put fabric to default state + cisco.dcnm.dcnm_interface: + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: overridden # only choose form [merged, replaced, deleted, overridden, query] + register: result + when: IT_CONTEXT is not defined + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: IT_CONTEXT is not defined + + +## sub + + +############################################## +## MERGE ## +############################################## + + - name: Create sub-interfaces + cisco.dcnm.dcnm_interface: &sub_merge + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: merged # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: "{{ ansible_sub_intf1 }}" # should be of the form eth. + type: sub_int # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: subint # choose from [subint] + vlan: 100 # vlan ID [min:2, max:3967] + int_vrf: "" # VRF name + ipv4_addr: 192.168.30.1 # ipv4 address for the sub-interface + ipv4_mask_len: 24 # choose between [min:8, max:31] + ipv6_addr: fd0f::0401 # ipV6 address for the sub-interface + ipv6_mask_len: 64 # choose between [min:64, max:127] + mtu: 9216 # choose between [min:576, max:9216] + cmds: # Freeform config + - no shutdown + description: "sub interface eth1/1.1 configuration" + + - name: "{{ ansible_sub_intf2 }}" # should be of the form eth. + type: sub_int # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: subint # choose from [subint] + vlan: 101 # vlan ID [min:2, max:3967] + int_vrf: "" # VRF name + ipv4_addr: 192.168.31.1 # ipv4 address for the sub-interface + ipv4_mask_len: 24 # choose between [min:8, max:31] + ipv6_addr: fd1f::0402 # ipV6 address for the sub-interface + ipv6_mask_len: 64 # choose between [min:64, max:127] + mtu: 9216 # choose between [min:576, max:9216] + cmds: # Freeform config + - no shutdown + description: "sub interface eth1/1.2 configuration" + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 2' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["replaced"] | length) == 0' + - '(result["diff"][0]["overridden"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 2' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## REPLACE ## +############################################## + + - name: Replace sub-interfaces + cisco.dcnm.dcnm_interface: &sub_replace + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: replaced # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: "{{ ansible_sub_intf1 }}" # should be of the form eth. + type: sub_int # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true ## choose from [true, false] + mode: subint # choose from [subint] + vlan: 200 ## vlan ID [min:2, max:3967] + int_vrf: "" # VRF name + ipv4_addr: 192.168.32.1 ## ipv4 address for the sub-interface + ipv4_mask_len: 24 # choose between [min:8, max:31] + ipv6_addr: fd2f::0403 # ipV6 address for the sub-interface + ipv6_mask_len: 64 # choose between [min:64, max:127] + mtu: 1500 ## choose between [min:576, max:9216] + cmds: # Freeform config + - no shutdown + description: "sub interface eth1/1.1 configuration - replace" + + - name: "{{ ansible_sub_intf2 }}" # should be of the form eth. + type: sub_int # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: subint # choose from [subint] + vlan: 201 ## vlan ID [min:2, max:3967] + int_vrf: "" # VRF name + ipv4_addr: 192.168.33.1 ## ipv4 address for the sub-interface + ipv4_mask_len: 24 ## choose between [min:8, max:31] + ipv6_addr: fd3f::0404 # ipV6 address for the sub-interface + ipv6_mask_len: 64 # choose between [min:64, max:127] + mtu: 1500 ## choose between [min:576, max:9216] + cmds: # Freeform config + - no shutdown + description: "sub interface eth1/1.2 configuration - replace" + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["replaced"] | length) == 2' + - '(result["diff"][0]["overridden"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 2' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + - name: Replace sub-interfaces - Idempotence + cisco.dcnm.dcnm_interface: *sub_replace + register: result + + - assert: + that: + - '(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: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + +############################################## +## CLEANUP ## +############################################## + + always: + + - name: Put fabric to default state + cisco.dcnm.dcnm_interface: + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: overridden # only choose form [merged, replaced, deleted, overridden, query] + register: result + when: IT_CONTEXT is not defined + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: IT_CONTEXT is not defined + + +## svi + + +############################################## +## MERGE ## +############################################## + + - name: Create SVI interfaces including optional parameters + cisco.dcnm.dcnm_interface: + check_deploy: True + fabric: "{{ ansible_svi_fabric }}" + state: merged # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: vlan1001 # should be of the form vlan + type: svi # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + int_vrf: blue # optional, Interface VRF name, default is "default" + ipv4_addr: 192.168.2.1 # optional, Interfae IP, default is "" + ipv4_mask_len: 24 # optional, IP mask length, default is "" + mtu: 9216 # optional, MTU default is "" + route_tag: 1001 # optional, Routing TAG, default is "" + disable_ip_redirects: true # optional, flag to enable/disable IP redirects, default is "false" + cmds: # Freeform config + - no shutdown + admin_state: true # Flag to enable/disable Vlan interaface + enable_hsrp: true # optional, flag to enable/disable HSRP on the interface, default is "false" + hsrp_vip: 192.168.2.100 # optional, Virtual IP address for HSRP, default is "" + hsrp_group: 10 # optional, HSRP group, default is "" + hsrp_priority: 5 # optional, HSRP priority, default is "" + hsrp_vmac: 0000.0101.ac0a # optional, HSRP virtual MAC, default is "" + dhcp_server_addr1: 192.200.1.1 # optional, DHCP relay server address, default is "" + vrf_dhcp1: blue # optional, VRF to reach DHCP server. default is "" + dhcp_server_addr2: 192.200.1.2 # optional, DHCP relay server address, default is "" + vrf_dhcp2: blue # optional, VRF to reach DHCP server. default is "" + dhcp_server_addr3: 192.200.1.3 # optional, DHCP relay server address, default is "" + vrf_dhcp3: blue # optional, VRF to reach DHCP server. default is "" + adv_subnet_in_underlay: true # optional, flag to enable/disable advertisements of subnets into underlay, default is "false" + enable_netflow: false # optional, flag to enable netflow, default is "false" + netflow_monitor: svi1001 # optional, name of netflow monitor, default is "" + hsrp_version: 1 # optional, HSRP protocol version, default is 1 + preempt: true # optional, flag to enable/disable overthrow of low priority active routers, optional is "false" + mode: vlan # choose from [vlan, vlan_admin_state], default is "vlan" + description: Switched vlan interface 1001 # optional, Interface description, default is "" + register: result + + - 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: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## REPLACE ## +############################################## + + - name: Replace SVI interface + cisco.dcnm.dcnm_interface: &svi_replace + check_deploy: True + fabric: "{{ ansible_svi_fabric }}" + state: replaced # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: vlan1001 # should be of the form vlan + type: svi # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + int_vrf: red # optional, Interface VRF name, default is "default" + ipv4_addr: 192.169.2.1 # optional, Interfae IP, default is "" + ipv4_mask_len: 20 # optional, IP mask length, default is "" + mtu: 9210 # optional, MTU default is "" + route_tag: 1002 # optional, Routing TAG, default is "" + disable_ip_redirects: false # optional, flag to enable/disable IP redirects, default is "false" + cmds: # Freeform config + - no shutdown + admin_state: false # Flag to enable/disable Vlan interaface + enable_hsrp: true # optional, flag to enable/disable HSRP on the interface, default is "false" + hsrp_vip: 192.169.2.100 # optional, Virtual IP address for HSRP, default is "" + hsrp_group: 11 # optional, HSRP group, default is "" + hsrp_priority: 5 # optional, HSRP priority, default is "" + hsrp_vmac: 0000.0102.ac0a # optional, HSRP virtual MAC, default is "" + dhcp_server_addr1: 193.200.1.1 # optional, DHCP relay server address, default is "" + vrf_dhcp1: green # optional, VRF to reach DHCP server. default is "" + dhcp_server_addr2: 193.200.1.2 # optional, DHCP relay server address, default is "" + vrf_dhcp2: green # optional, VRF to reach DHCP server. default is "" + dhcp_server_addr3: 193.200.1.3 # optional, DHCP relay server address, default is "" + vrf_dhcp3: green # optional, VRF to reach DHCP server. default is "" + adv_subnet_in_underlay: false # optional, flag to enable/disable advertisements of subnets into underlay, default is "false" + enable_netflow: false # optional, flag to enable netflow, default is "false" + netflow_monitor: svi1002 # optional, name of netflow monitor, default is "" + hsrp_version: 2 # optional, HSRP protocol version, default is 1 + preempt: false # optional, flag to enable/disable overthrow of low priority active routers, optional is "false" + mode: vlan # choose from [vlan, vlan_admin_state], default is "vlan" + description: Switched vlan interface 1001 - Rep # optional, Interface description, default is "" + register: result + + - 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) == 1' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + - name: Replace SVI interfaces - Idempotence + cisco.dcnm.dcnm_interface: *svi_replace + register: result + + - 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: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## CLEANUP ## +############################################## + + always: + + - name: Put fabric to default state + cisco.dcnm.dcnm_interface: + check_deploy: True + fabric: "{{ ansible_svi_fabric }}" + state: overridden # only choose form [merged, replaced, deleted, overridden, query] + register: result + when: IT_CONTEXT is not defined + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: IT_CONTEXT is not defined + + +############################################## +## MERGE ## +############################################## + + - name: Create eth/sub/lo interfaces + cisco.dcnm.dcnm_interface: + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: merged # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: "{{ ansible_eth_intf7 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: trunk # choose from [trunk, access, routed, monitor, epl_routed] + speed: 'Auto' # choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + 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] + cmds: # Freeform config + - no shutdown + description: "eth interface acting as trunk" + + - name: lo100 # should be of the form lo + type: lo # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch where to deploy the config + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: lo # choose from [lo] + int_vrf: "" # VRF name + ipv4_addr: 192.168.1.1 # ipv4 address for the loopback interface + ipv6_addr: fd08::0201 # ipV6 address for the loopback interface + route_tag: "" # Routing Tag for the interface + cmds: # Freeform config + - no shutdown + description: "loopback interface 100 configuration" + + - name: "{{ ansible_sub_intf1 }}" # should be of the form eth. + type: sub_int # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: subint # choose from [subint] + vlan: 100 # vlan ID [min:2, max:3967] + int_vrf: "" # VRF name + ipv4_addr: 192.168.30.1 # ipv4 address for the sub-interface + ipv4_mask_len: 24 # choose between [min:8, max:31] + ipv6_addr: fd0d::0401 # ipV6 address for the sub-interface + ipv6_mask_len: 64 # choose between [min:64, max:127] + mtu: 9216 # choose between [min:576, max:9216] + cmds: # Freeform config + - no shutdown + description: "sub interface eth1/1.1 configuration" + + register: result + + - assert: + that: + - '(result["diff"][0]["merged"] | length) == 3' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["replaced"] | length) == 0' + - '(result["diff"][0]["overridden"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 3' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + - name: Modify aggregate members like cmds + cisco.dcnm.dcnm_interface: + check_deploy: True + fabric: "{{ ansible_it_fabric }}" + state: merged # only choose form [merged, replaced, deleted, overridden, query] + config: + - name: "{{ ansible_eth_intf7 }}" # should be of the form eth + type: eth # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: trunk # choose from [trunk, access, routed, monitor, epl_routed] + speed: 'Auto' # choose from ['Auto', '100Mb', '1Gb', '10Gb', '25Gb', '40Gb', '100Gb' ] + 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] + cmds: # Freeform config + - spanning-tree bpduguard enable + description: "eth interface acting as trunk" + + - name: lo100 # should be of the form lo + type: lo # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch where to deploy the config + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: lo # choose from [lo] + int_vrf: "" # VRF name + ipv4_addr: 192.168.1.1 # ipv4 address for the loopback interface + ipv6_addr: fd08::0201 # ipV6 address for the loopback interface + route_tag: "" # Routing Tag for the interface + cmds: # Freeform config + - logging event port link-status + description: "loopback interface 100 configuration" + + - name: "{{ ansible_sub_intf1 }}" # should be of the form eth. + type: sub_int # choose from this list [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + admin_state: true # choose from [true, false] + mode: subint # choose from [subint] + vlan: 100 # vlan ID [min:2, max:3967] + int_vrf: "" # VRF name + ipv4_addr: 192.168.30.1 # ipv4 address for the sub-interface + ipv4_mask_len: 24 # choose between [min:8, max:31] + ipv6_addr: fd0d::0401 # ipV6 address for the sub-interface + ipv6_mask_len: 64 # choose between [min:64, max:127] + mtu: 9216 # choose between [min:576, max:9216] + cmds: # Freeform config + - logging event port link-status + description: "sub interface eth1/1.1 configuration" + + register: result + + - assert: + that: + - '(result["diff"][0]["merged"] | length) == 3' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["replaced"] | length) == 0' + - '(result["diff"][0]["overridden"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 3' + - '(result["diff"][0]["merged"][0]["interfaces"][0]["nvPairs"]["CONF"].split("\n") | length) == 2' + - '(result["diff"][0]["merged"][1]["interfaces"][0]["nvPairs"]["CONF"].split("\n") | length) == 2' + - '(result["diff"][0]["merged"][2]["interfaces"][0]["nvPairs"]["CONF"].split("\n") | length) == 2' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## CLEANUP ## +############################################## + + always: + + - name: Put fabric to default state + cisco.dcnm.dcnm_interface: + check_deploy: True + fabric: "{{ ansible_svi_fabric }}" + state: overridden # only choose form [merged, replaced, deleted, overridden, query] + register: result + when: IT_CONTEXT is not defined + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: IT_CONTEXT is not defined From 7bbc67ae392e8b590a18a1589824dcc4aae5b290 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 5 Jul 2023 10:35:24 +0530 Subject: [PATCH 119/248] Update sanity.yml --- .../targets/dcnm_interface/tests/dcnm/sanity.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yml index 964a47815..9a099bbb8 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yml @@ -6,6 +6,7 @@ - name: Remove local log file local_action: command rm -f dcnm_intf.log + tags: sanity - name: Put the fabric to default state cisco.dcnm.dcnm_interface: @@ -13,13 +14,17 @@ fabric: "{{ ansible_it_fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity -- block: +- name: Sanity tests + tags: sanity + block: ############################################## ## MERGE ## From 0dbe66171ea7b84de4a76d2a4c78a56a474ec355 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:02:48 +0530 Subject: [PATCH 120/248] Create sanity.yml --- .../targets/dcnm_links/tests/dcnm/sanity.yml | 288 ++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 tests/integration/targets/dcnm_links/tests/dcnm/sanity.yml diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yml new file mode 100644 index 000000000..b78f24de6 --- /dev/null +++ b/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yml @@ -0,0 +1,288 @@ +############################################## +## SETUP ## +############################################## + +- name: Remove local log file + local_action: command rm -f dcnm_links.log + +- tags: sanity + block: + +############################################## +## DELETE ## +############################################## + + - name: Initial setup - Delete Links + cisco.dcnm.dcnm_links: &links_delete + state: deleted # choose from [merged, replaced, deleted, query] + src_fabric: "{{ ansible_ipv6_fabric }}" + config: + - dst_fabric: "{{ ansible_ipv6_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_ipv6_switch1 }}" # Device on the Source fabric + dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric + + - 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 + + - 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 + + - dst_fabric: "{{ ansible_ipv6_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_ipv6_switch2 }}" # Device on the Destination fabric + + - dst_fabric: "{{ ansible_ipv6_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_ipv6_switch2 }}" # Device on the Destination fabric + + register: result + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## MERGE ## +############################################## + + - name: Create Links including all optional parameters + cisco.dcnm.dcnm_links: &links_merge_with_opt + state: merged # choose from [merged, replaced, deleted, query] + src_fabric: "{{ ansible_ipv6_fabric }}" + config: + - dst_fabric: "{{ ansible_ipv6_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_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: 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 # + 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: "{{ 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 ] + - 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 ] + + 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: 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: 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 "" + + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 3' + - '(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) == 2' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################### +### QUERY ## +############################################### + + - name: Query Links - with Src Fabric + cisco.dcnm.dcnm_links: + state: query # choose from [merged, replaced, deleted, query] + src_fabric: "{{ ansible_ipv6_fabric }}" + register: result + + - assert: + that: + '(result["response"] | length) >= 3' + + - name: Query Links - with Src & Dst Fabric + 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: + that: + '(result["response"] | length) >= 3' + +############################################## +## REPLACE ## +############################################## + + - name: Replace Links + cisco.dcnm.dcnm_links: &links_replace + state: replaced # choose from [merged, replaced, deleted, query] + src_fabric: "{{ ansible_ipv6_fabric }}" + config: + - dst_fabric: "{{ ansible_ipv6_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_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: 193.169.1.1 # optional, default is "" + peer2_ipv4_addr: 193.169.1.2 # optional, default is "" + peer1_ipv6_addr: 2089:0201::01 # IP address of the Source interface + peer2_ipv6_addr: 2089:0201::02 # IP address of the Source interface + admin_state: true # choose from [true, false] + mtu: 3216 # + enable_macsec: false # optional, choose from [true, false] + peer1_cmds: # Freeform config for source device + - cdp enable # optional, default is "" + peer2_cmds: # Freeform config for destination device + - cdp enable # optional, default is "" + + - 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 ] + - 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 ] + + profile: + peer1_ipv4_addr: 193.169.2.1 # optional, default is "" + peer2_ipv4_addr: 193.169.2.2 # optional, default is "" + peer1_ipv6_addr: 2089:0202::01 # IP address of the Source interface + peer2_ipv6_addr: 2089:0202::02 # IP address of the Source interface + admin_state: true # choose from [true, false] + mtu: 2000 # + 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] + + register: result + + - 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) == 2' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## IDEMPOTENCE ## +############################################## + + - name: Repalce Links - Idempotence + cisco.dcnm.dcnm_links: *links_replace + register: result + + - 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) == 2' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################### +### CLEANUP ## +############################################### + + always: + + - name: Cleanup - Delete Links + 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 From 8a8c8f5b5f215e7520bd80542e72be90369f02e8 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:14:00 +0530 Subject: [PATCH 121/248] Update sanity.yml --- .../dcnm_network/tests/dcnm/sanity.yml | 407 +----------------- 1 file changed, 6 insertions(+), 401 deletions(-) diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yml index 6ef11e84d..d32ea4177 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yml @@ -12,7 +12,7 @@ when: controller_version >= "12" tags: sanity -- name: MERGED - Verify if fabric - Fabric1 is deployed. +- name: Verify if fabric - Fabric1 is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" @@ -22,71 +22,15 @@ - assert: that: - 'result.response.DATA != None' - tags: sanity - -- name: MERGED - setup - Clean up any existing networks - cisco.dcnm.dcnm_network: - fabric: "{{ test_fabric }}" - state: deleted - tags: sanity - -############################################## -## MERGED ## -############################################## - -- name: MERGED - Create New Network without Deploy - cisco.dcnm.dcnm_network: - fabric: "{{ test_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' - deploy: False - register: result - tags: sanity - -- name: Query fabric for creation of Network Object - cisco.dcnm.dcnm_network: - fabric: "{{ test_fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.displayName is search('ansible-net13')" - - "query_result.response[0].parent.networkId is search('7005')" - - "query_result.response[0].parent.vrf is search('Tenant-1')" - retries: 5 - delay: 2 tags: sanity -- assert: - that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.diff[0].attach|length == 0' - - 'result.diff[0].net_name == "ansible-net13"' - - 'result.diff[0].net_id == 7005' - - 'result.diff[0].vrf_name == "Tenant-1"' - tags: sanity - -- name: MERGED - setup - Clean up any existing networks +- name: DELETED - setup - Clean up any existing networks cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: deleted tags: sanity - - - - - - - -- name: OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach +- name: MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: merged @@ -215,13 +159,11 @@ - 'result.diff[0].vrf_name == "Tenant-1"' - 'result.diff[1].attach[0].deploy == false' - '"{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address' - - 'result.diff[1].net_name == "ansible-net12"' - tags: sanity - + - 'result.diff[1].net_name == "ansible-net12"' + tags: sanity - name: OVERRIDDEN - conf1 - Idempotence cisco.dcnm.dcnm_network: *conf1 register: result - tags: sanity - assert: that: @@ -233,227 +175,15 @@ cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: deleted - tags: sanity - - - - - - - - - - -- name: Setup - Clean up any existing networks - cisco.dcnm.dcnm_network: - fabric: "{{ test_fabric }}" - state: deleted - register: result - until: - - "result.response | length == 0" - retries: 30 - delay: 2 - tags: sanity - -- name: Create, Attach and Deploy Multiple Network with Single Switch Attach - cisco.dcnm.dcnm_network: - fabric: "{{ test_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: "{{ ansible_switch1 }}" - ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] - 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: "{{ ansible_switch2 }}" - ports: ["{{ ansible_sw2_int1 }}", "{{ ansible_sw2_int2 }}"] - deploy: true - deploy: false - register: result - tags: sanity - -- name: Query fabric state until networkStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_network: - fabric: "{{ test_fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.networkStatus is search('DEPLOYED')" - - "query_result.response[1].parent.networkStatus is search('DEPLOYED')" - retries: 30 - delay: 2 - tags: sanity - -- 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[2].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[2].DATA|dict2items)[1].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-net13"' - - 'result.diff[0].net_id == 7005' - - 'result.diff[0].vrf_name | regex_search("Tenant-[1|2]", ignorecase=True)' - - 'result.diff[1].attach[0].deploy == true' - - '"{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address' - - 'result.diff[1].net_name == "ansible-net12"' - - 'result.diff[1].net_id == 7002' - - 'result.diff[1].vrf_name | regex_search("Tenant-[1|2]", ignorecase=True)' - tags: sanity - -############################################### -### QUERY ## -############################################### - -- name: QUERY - Query the Network - cisco.dcnm.dcnm_network: - fabric: "{{ test_fabric }}" - state: query - 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' - - 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' - register: result - tags: sanity - -- assert: - that: - - 'result.changed == false' - - 'result.response[0].parent.networkName == "ansible-net13"' - - 'result.response[0].parent.networkId | regex_search("700[2|5]", ignorecase=True)' - - 'result.response[0].parent.networkTemplate == "Default_Network_Universal"' - - 'result.response[0].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)' - - 'result.response[0].attach[0].isLanAttached== true' - - 'result.response[0].attach[0].lanAttachState== "DEPLOYED"' - - 'result.response[0].attach[0].networkName== "ansible-net13"' - - 'result.response[0].attach[1].isLanAttached== false' - - 'result.response[0].attach[1].lanAttachState== "NA"' - - 'result.response[0].attach[1].networkName== "ansible-net13"' - - 'result.response[1].parent.networkName == "ansible-net12"' - - 'result.response[1].parent.networkId | regex_search("700[2|5]", ignorecase=True)' - - 'result.response[1].parent.networkTemplate == "Default_Network_Universal"' - - 'result.response[1].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)' - - 'result.response[1].attach[0].isLanAttached== true' - - 'result.response[1].attach[0].lanAttachState== "DEPLOYED"' - - 'result.response[1].attach[0].networkName== "ansible-net12"' - - 'result.response[1].attach[1].isLanAttached== false' - - 'result.response[1].attach[1].lanAttachState== "NA"' - - 'result.response[1].attach[1].networkName== "ansible-net12"' - tags: sanity - -- name: QUERY - Query the Network without the config element - cisco.dcnm.dcnm_network: - fabric: "{{ test_fabric }}" - state: query - register: result tags: sanity -- assert: - that: - - 'result.changed == false' - - 'result.response[0].parent.networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' - - 'result.response[0].parent.networkId | regex_search("700[2|5]", ignorecase=True)' - - 'result.response[0].parent.networkTemplate == "Default_Network_Universal"' - - 'result.response[0].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)' - - 'result.response[0].attach[0].isLanAttached== true' - - 'result.response[0].attach[0].lanAttachState== "DEPLOYED"' - - 'result.response[0].attach[0].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' - - 'result.response[0].attach[1].isLanAttached== false' - - 'result.response[0].attach[1].lanAttachState== "NA"' - - 'result.response[0].attach[1].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' - - 'result.response[1].parent.networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' - - 'result.response[1].parent.networkId | regex_search("700[2|5]", ignorecase=True)' - - 'result.response[1].parent.networkTemplate == "Default_Network_Universal"' - - 'result.response[1].parent.vrf | regex_search("Tenant-[1|2]", ignorecase=True)' - - 'result.response[1].attach[0].isLanAttached== true' - - 'result.response[1].attach[0].lanAttachState== "DEPLOYED"' - - 'result.response[1].attach[0].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' - - 'result.response[1].attach[1].isLanAttached== false' - - 'result.response[1].attach[1].lanAttachState== "NA"' - - 'result.response[1].attach[1].networkName | regex_search("ansible-net1[2|3]", ignorecase=True)' - tags: sanity - -- name: Delete all the networks +- name: REPLACED - setup - Clean up any existing networks cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: deleted - register: result - tags: sanity - -- name: Query fabric state until all networks are deleted - cisco.dcnm.dcnm_network: - fabric: "{{ test_fabric }}" - state: query - register: query_result - until: - - "query_result.response | length == 0" - retries: 30 - delay: 2 - tags: sanity - -- 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[0].MESSAGE == "OK"' - - 'result.response[1].MESSAGE == "OK"' - - 'result.response[2].MESSAGE == "OK"' - - 'result.response[3].MESSAGE == "OK"' - - 'result.response[3].METHOD == "DELETE"' - - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == false' - - 'result.diff[1].attach[0].deploy == false' - - '"{{ ansible_switch1 }}" or "{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[1].attach[0].ip_address' - - '"ansible-net13" or "ansible-net12" in result.diff[1].net_name' - - '"ansible-net13" or "ansible-net12" in result.diff[0].net_name' tags: sanity - - - - - - - - - - - - name: REPLACED - Create, Attach and Deploy Multiple Network with Single Switch Attach cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" @@ -588,128 +318,3 @@ - 'result.changed == false' - 'result.response|length == 0' tags: sanity - - - - - - - - - - - - - - - - - - - - - -- name: DELETED - setup - Clean up any existing networks - cisco.dcnm.dcnm_network: - fabric: "{{ test_fabric }}" - state: deleted - tags: sanity - -- name: DELETED - Create, Attach and Deploy Single Network with multiple switch Attach - cisco.dcnm.dcnm_network: - fabric: "{{ test_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: "{{ ansible_switch1 }}" - ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] - deploy: true - - ip_address: "{{ ansible_switch2 }}" - ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] - deploy: true - deploy: false - register: result - tags: sanity - -- name: Query fabric state until networkStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_network: - fabric: "{{ test_fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.networkStatus is search('DEPLOYED')" - retries: 30 - delay: 2 - tags: sanity - -- 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' - - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address' - - 'result.diff[0].attach[1].deploy == true' - - '"{{ ansible_switch2 }}" in result.diff[0].attach[1].ip_address' - - 'result.diff[0].net_name == "ansible-net13"' - - 'result.diff[0].net_id == 7005' - - 'result.diff[0].vrf_name == "Tenant-1"' - tags: sanity - -############################################### -### DELETED ## -############################################### - -- name: DELETED - Delete Single Network with deleted state - cisco.dcnm.dcnm_network: &conf - fabric: "{{ test_fabric }}" - state: deleted - 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' - register: result - tags: sanity - -- 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].MESSAGE == "OK"' - - 'result.response[1].MESSAGE == "OK"' - - 'result.response[2].MESSAGE == "OK"' - - 'result.response[2].METHOD == "DELETE"' - - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == false' - - 'result.diff[0].attach[1].deploy == false' - - '"{{ ansible_switch1 }}" or "{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[0].attach[1].ip_address' - - 'result.diff[0].net_name == "ansible-net13"' - tags: sanity - -- name: DELETED - conf - Idempotence - cisco.dcnm.dcnm_network: *conf - register: result - tags: sanity - -- assert: - that: - - 'result.changed == false' - - 'result.response|length == 0' - - 'result.diff|length == 0' From 95ca3b9541ebe85361a19c899a0afa5637529b4f Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:26:00 +0530 Subject: [PATCH 122/248] Create sanity.yml --- .../targets/dcnm_policy/tests/dcnm/sanity.yml | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yml diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yml new file mode 100644 index 000000000..196e639e4 --- /dev/null +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yml @@ -0,0 +1,200 @@ +############################################## +## SETUP ## +############################################## + +- name: Remove local log file + local_action: command rm -f policy.log + tags: sanity + +- name: Put the fabric to default state + cisco.dcnm.dcnm_policy: + fabric: "{{ ansible_it_fabric }}" + state: deleted # only choose form [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 + tags: sanity + +- assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + tags: sanity + + +- tags: sanity + block: + +############################################## +## MERGE ## +############################################## + + - name: Create different non-existing policies + cisco.dcnm.dcnm_policy: &dcnm_pol + fabric: "{{ ansible_it_fabric }}" + deploy: true + state: merged + 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 + + - 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 + + - name: template_103 # This must be a valid template name + create_additional_policy: false # Do not create a policy if it already exists + description: Both description and priority given + priority: 500 + + - 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 + + - 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: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 5' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 5' + + # Assert for Create responses + - assert: + that: + - 'item["RETURN_CODE"] == 200' + - '"is created successfully" in item["DATA"]["successList"][0]["message"]' + when: (my_idx < (result["diff"][0]["merged"] | length)) + loop: '{{ result.response }}' + loop_control: + index_var: my_idx + + # Assert for deploy responses + - 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 + + - name: Setting fact + 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 + + - name: Show the policy_list information + debug: + var: query_policy_list + + - name: Setting fact + set_fact: + list_len: "{{ query_policy_list | length }}" + +############################################## +## QUERY ## +############################################## + - name: Query all policies from the specified switches + cisco.dcnm.dcnm_policy: + fabric: "{{ ansible_it_fabric }}" + state: query + config: + - switch: + - 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' + +############################################## +## MODIFY ## +############################################## + + - name: Setting fact + 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 + + - name: Show the policy_list information + debug: + var: modify_policy_list + + - name: Setting fact + set_fact: + list_len: "{{ modify_policy_list | length }}" + + - name: Modify existing policy using template name - should create the policy + cisco.dcnm.dcnm_policy: + fabric: "{{ ansible_it_fabric }}" + deploy: true + state: merged + config: + - name: template_101 # This must be a valid template name + create_additional_policy: false # Do not create a policy if it already exists + description: Trying to modify existing policy using templateName + priority: 1000 + - switch: + - 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' + + +############################################## +## CLEANUP ## +############################################## + + always: + + - name: Delete all created policies + 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 + - name: template_102 # This can either be a policy name like POLICY-xxxxx or template name + - name: template_103 # This can either be a policy name like POLICY-xxxxx or template name + - 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 }}" + register: result + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + - 'item["MESSAGE"] == "OK"' + loop: '{{ result.response }}' From 808367cd5514c44624e0b7f0d921a9337625eb54 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:29:15 +0530 Subject: [PATCH 123/248] Update main.yaml --- .../targets/prepare_dcnm_template/tasks/main.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/prepare_dcnm_template/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_template/tasks/main.yaml index c30132ac9..363281adc 100644 --- a/tests/integration/targets/prepare_dcnm_template/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_template/tasks/main.yaml @@ -13,11 +13,13 @@ - switch: - ip: "{{ ansible_switch1 }}" register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: Initialize - Delete the templates cisco.dcnm.dcnm_template: @@ -31,6 +33,7 @@ - name: template_inuse_1 - name: template_inuse_2 - name: my_feature_telemetry + tags: sanity register: result @@ -38,6 +41,7 @@ that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - block: @@ -82,6 +86,7 @@ subscription 8 dst-grp 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 @@ -201,4 +206,4 @@ when: (my_idx == (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx \ No newline at end of file + index_var: my_idx From 5638265ebb41a33b4f9b1b7fde085cdf9930c366 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:33:49 +0530 Subject: [PATCH 124/248] Update main.yaml --- .../targets/prepare_dcnm_policy/tasks/main.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml index 1dbcbd36f..a52b880b3 100644 --- a/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml @@ -18,15 +18,18 @@ - ip: "{{ ansible_switch1 }}" - ip: "{{ ansible_switch2 }}" register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: Initialize the setup - delete all templates cisco.dcnm.dcnm_template: @@ -41,11 +44,13 @@ - name: my_feature_telemetry register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - block: @@ -54,6 +59,7 @@ ############################################## - name: Create templates + tags: sanity cisco.dcnm.dcnm_template: &temp_merge state: merged # only choose form [merged, deleted, query] config: @@ -148,12 +154,14 @@ - '(result["diff"][0]["merged"] | length) == 5' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' loop: '{{ result.response }}' + tags: sanity - name: Create templates with arguments cisco.dcnm.dcnm_template: From 36dd5b7bc399943d853bda90cf39b7cc26016374 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:48:43 +0530 Subject: [PATCH 125/248] Create sanity.yml --- .../tests/dcnm/sanity.yml | 218 ++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yml diff --git a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yml new file mode 100644 index 000000000..f9db01118 --- /dev/null +++ b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yml @@ -0,0 +1,218 @@ +############################################## +## SETUP ## +############################################## + +- name: Remove local log file + local_action: command rm -f res_mgr.log + tags: sanity + +- name: Delete Resources + cisco.dcnm.dcnm_resource_manager: &rm_delete + state: deleted # choose form [merged, deleted, query] + 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: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + + - 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: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + + - 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: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + switch: # provide the switch information to which the given resource is attached + - "{{ ansible_switch1 }}" + - "{{ ansible_switch2 }}" + + - 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'] + switch: # provide the switch information to which the given resource is attached + - "{{ ansible_switch1 }}" + - "{{ ansible_switch2 }}" + + - 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: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + + - 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_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + 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 + - "{{ ansible_switch1 }}" + register: result + tags: sanity + +- assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + tags: sanity + +- tags: sanity + block: + +############################################## +## MERGE ## +############################################## + + - name: Create Resources + cisco.dcnm.dcnm_resource_manager: &rm_merge + state: merged # choose form [merged, deleted, query] + 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: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + resource: "101" # The value of the resource being created + + - 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: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + resource: "102" # The value of the resource being created + + - 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: "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 }}" + - "{{ ansible_switch2 }}" + resource: "200" # The value of the resource being created + + - 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'] + 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 + + - 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: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + resource: "110.1.1.1" # The value of the resource being created + + - 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_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::04" # The value of the resource being created + + - 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 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' + loop: '{{ result.response }}' + +############################################## +## QUERY ## +############################################## + + - name: Query all Resources - no filters + cisco.dcnm.dcnm_resource_manager: + state: query # choose form [merged, deleted, query] + fabric: "{{ ansible_it_fabric }}" + register: result + + - assert: + that: + - '(result["response"] | length) != 0' + + - name: 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" + + - name: Query Resources - filter by entity name + cisco.dcnm.dcnm_resource_manager: + state: query # choose form [merged, deleted, query] + fabric: "{{ ansible_it_fabric }}" + config: + - entity_name: "l3_vni_fabric" # A unique name to identify the resource + - entity_name: "l2_vni_fabric" # A unique name to identify the resource + - entity_name: "loopback_dev" # A unique name to identify the resource + - entity_name: "{{ ansible_sno_1 }}~{{ ansible_sno_2 }}" # A unique name to identify the resource + - entity_name: "{{ ansible_sno_1 }}~{{ intf_1_10 }}" # A unique name to identify the resource + - entity_name: "{{ ansible_sno_1 }}~{{ intf_1_2 }}~{{ ansible_sno_2 }}~{{ intf_1_2 }}" # A unique name to identify the resource + - 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: + that: + - 'item["entityName"] in {{ entity_names }}' + loop: '{{ result.response }}' + + + +############################################## +## CLEANUP ## +############################################## + + always: + + - name: 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: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: IT_CONTEXT is not defined From 4cc84e53f84d6e9f19191768e962569a8b4c8e93 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 7 Jul 2023 12:32:39 +0530 Subject: [PATCH 126/248] Create sanity.yml --- .../dcnm_service_node/tests/dcnm/sanity.yml | 289 ++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yml diff --git a/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yml new file mode 100644 index 000000000..954d4b879 --- /dev/null +++ b/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yml @@ -0,0 +1,289 @@ +############################################## +## SETUP ## +############################################## + +- 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: + 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" + tags: sanity + +- name: REPLACED - Verify if fabric is deployed. + cisco.dcnm.dcnm_rest: + method: GET + path: "{{ rest_path }}" + register: result + tags: sanity + +- assert: + that: + - 'result.response.DATA != None' + tags: sanity + +- name: REPLACED - Verify if service fabric is deployed. + cisco.dcnm.dcnm_rest: + method: GET + path: "{{ rest_ext_path }}" + register: result + tags: sanity + +- assert: + that: + - 'result.response.DATA != None' + tags: sanity + +- name: 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 + +- name: REPLACED - Query fabric state before proceeding + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_ext_fabric }}" + state: query + register: result + tags: sanity + + until: + - 'result.response|length == 0' + retries: 10 + delay: 5 + tags: sanity + +- name: REPLACED - Create Service Node with 2 switches and vPC Interface with type firewall + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + 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 }}" + register: result + tags: sanity + +- 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"' + tags: sanity + +- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state + wait_for: + timeout: 20 + tags: sanity + +############################################### +### REPLACED ## +############################################### + +- name: REPLACED - Replace Service Node with form factor physical + cisco.dcnm.dcnm_service_node: &conf + fabric: "{{ ansible_it_fabric }}" + 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 }}" + register: result + tags: sanity + +- 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"' + tags: sanity + +- name: REPLACED - sleep for 40 seconds for DCNM to completely update the state + wait_for: + timeout: 40 + tags: sanity + +- name: REPLACED - conf - Idempotence + cisco.dcnm.dcnm_service_node: *conf + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + tags: sanity + +- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state + wait_for: + timeout: 20 + tags: sanity + +######################################################### + +- name: OVERRIDDEN - Clean up any existing service node + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_ext_fabric }}" + state: deleted + tags: sanity + +- name: OVERRIDDEN - Query fabric state before proceeding + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_ext_fabric }}" + state: query + register: result + tags: sanity + + until: + - 'result.response|length == 0' + retries: 10 + delay: 5 + tags: sanity + +- name: OVERRIDDEN - Create Service Node with 2 switches and vPC Interface with type firewall + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + 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 }}" + register: result + tags: sanity + +- 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"' + tags: sanity + +- name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state + wait_for: + timeout: 20 + tags: sanity + +############################################### +### OVERRIDDEN ## +############################################### + +- name: OVERRIDDEN - Update service node - delete and create + cisco.dcnm.dcnm_service_node: &conf + fabric: "{{ ansible_it_fabric }}" + 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 }}" + - "{{ ansible_switch5 }}" + register: result + tags: sanity + +- 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"' + tags: sanity + +- name: OVERRIDDEN - sleep for 40 seconds for DCNM to completely update the state + wait_for: + timeout: 40 + tags: sanity + +- name: OVERRIDDEN - conf - Idempotence + cisco.dcnm.dcnm_service_node: *conf + register: result + tags: sanity + +- assert: + that: + - 'result.changed == false' + - 'result.response|length == 0' + tags: sanity + +- name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state + wait_for: + timeout: 20 + tags: sanity + +- name: OVERRIDDEN - Clean up any existing service node + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_ext_fabric }}" + state: deleted + tags: sanity + +- name: OVERRIDDEN - Query fabric state before proceeding + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_ext_fabric }}" + state: query + register: result + tags: sanity + + until: + - 'result.response|length == 0' + retries: 10 + delay: 5 + tags: sanity From e551371cbc41b57671453a33b1968edf4b0ac566 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 09:27:27 +0530 Subject: [PATCH 127/248] Create sanity.yml --- .../dcnm_service_policy/tests/dcnm/sanity.yml | 379 ++++++++++++++++++ 1 file changed, 379 insertions(+) create mode 100644 tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml diff --git a/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml new file mode 100644 index 000000000..bc693e647 --- /dev/null +++ b/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml @@ -0,0 +1,379 @@ +############################################## +## SETUP ## +############################################## + +- name: Remove local log file + local_action: command rm -f sp.log + tags: sanity + +- name: Delete service policies + cisco.dcnm.dcnm_service_policy: &dcnm_sp_del_all + 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_2 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + + - name: service_policy_3 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + + - name: service_policy_4 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + + - name: service_policy_5 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + register: result + tags: sanity + +- assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + tags: sanity + +- tags: sanity + block: + +############################################## +## MERGE ## +############################################## + + - name: Create service policy including all optional objects + cisco.dcnm.dcnm_service_policy: &dcnm_sp_create_all + 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 + 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 + + - 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 + 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 + + - 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 + 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 + + - 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 + 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 + + - 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 + 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 + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 5' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["modified"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 5' + + - name: Query service policies based on service node and policy name + cisco.dcnm.dcnm_service_policy: + fabric: "{{ ansible_it_fabric }}" # mandatory + service_fabric: "{{ ansible_it_service_fabric }}" # mandatory + state: query # optional, default merged + config: + - 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_3 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + + - name: service_policy_4 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + + - name: service_policy_5 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + 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) == 5' + - '(result["diff"][0]["deploy"] | length) == 0' + - '(result.response | length) == 5' + + + +############################################## +## OVERRRIDE ## +############################################## + + - name: Override and delete all service policies without any new one + cisco.dcnm.dcnm_service_policy: + fabric: "{{ ansible_it_fabric }}" # mandatory + service_fabric: "{{ ansible_it_service_fabric }}" # mandatory + state: overridden # optional, default merged + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 5' + - '(result["diff"][0]["modified"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 0' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + +############################################## +## 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 + 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 + 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 + + - 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 + 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] + + 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' + loop: '{{ result.response }}' + +############################################## +## REPLACE ## +############################################## + + - name: Replace some of the objects in already created policy + cisco.dcnm.dcnm_service_policy: &dcnm_sp_replace_all + fabric: "{{ ansible_it_fabric }}" # mandatory + service_fabric: "{{ ansible_it_service_fabric }}" # mandatory + attach: true # optional, default true + deploy: true # optional, default true + state: replaced # 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 + 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)] + action: deny # optional, default=permit, choices=[permit, deny] + 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 + 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: 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)] + 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_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' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + - name: Replace service policies - Idempotence + cisco.dcnm.dcnm_service_policy: *dcnm_sp_replace_all + 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' + +############################################## +## CLEANUP ## +############################################## + + always: + + - name: Delete service policies + cisco.dcnm.dcnm_service_policy: *dcnm_sp_del_all + register: result + when: IT_CONTEXT is not defined + tags: sanity + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: IT_CONTEXT is not defined + tags: sanity From 3e74975114ff3d890a5314b257ebeb77ea90dc12 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 09:29:27 +0530 Subject: [PATCH 128/248] Update main.yaml --- tests/integration/targets/dcnm_interface/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_interface/tasks/main.yaml b/tests/integration/targets/dcnm_interface/tasks/main.yaml index 78c5fb834..c072f092c 100644 --- a/tests/integration/targets/dcnm_interface/tasks/main.yaml +++ b/tests/integration/targets/dcnm_interface/tasks/main.yaml @@ -1,2 +1,2 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- { include: dcnm.yaml, tags: ['dcnm','sanity'] } From ef5d23a7d535ac7a497e477323a49158018c880c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 09:39:03 +0530 Subject: [PATCH 129/248] Update sanity.yml --- .../targets/dcnm_service_node/tests/dcnm/sanity.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yml index 954d4b879..b241e09ee 100644 --- a/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yml @@ -100,7 +100,7 @@ ############################################### - name: REPLACED - Replace Service Node with form factor physical - cisco.dcnm.dcnm_service_node: &conf + cisco.dcnm.dcnm_service_node: &conf1 fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" state: replaced @@ -135,8 +135,8 @@ timeout: 40 tags: sanity -- name: REPLACED - conf - Idempotence - cisco.dcnm.dcnm_service_node: *conf +- name: REPLACED - conf1 - Idempotence + cisco.dcnm.dcnm_service_node: *conf1 register: result tags: sanity @@ -214,7 +214,7 @@ ############################################### - name: OVERRIDDEN - Update service node - delete and create - cisco.dcnm.dcnm_service_node: &conf + cisco.dcnm.dcnm_service_node: &conf2 fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" state: overridden @@ -252,7 +252,7 @@ tags: sanity - name: OVERRIDDEN - conf - Idempotence - cisco.dcnm.dcnm_service_node: *conf + cisco.dcnm.dcnm_service_node: *conf2 register: result tags: sanity From ab101965ec31b4cc0b5b4d0e16f918972cd365d0 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:47:51 +0530 Subject: [PATCH 130/248] Updated config.yml --- .circleci/config.yml | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 86ac5f06b..576fcd033 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,14 +76,14 @@ jobs: export PATH="$PYENV_ROOT/shims/python:$PATH" export PYTHONPATH="$PYENV_ROOT/shims/python3:$PYTHONPATH" export PYTHONPATH="$PYENV_ROOT/shims/python:$PYTHONPATH" - echo "**********************" - whoami - echo "**********************" - echo $PYTHONPATH - echo $PATH - echo $HOME - echo $PYENV_ROOT - echo "**********************" + #echo "**********************" + # whoami + # echo "**********************" + # echo $PYTHONPATH + # echo $PATH + # echo $HOME + # echo $PYENV_ROOT + # echo "**********************" /home/circleci/.pyenv/bin/pyenv local python_3.9 # /home/circleci/.pyenv/bin/pyenv versions # /home/circleci/.pyenv/shims/python --version @@ -126,8 +126,25 @@ jobs: export PATH="/home/circleci/.ansible/collections/:$PATH" export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" - + export MODULENAME="<< parameters.modulename >>" pyenv local python_<< parameters.py_version >> + + echo "---" > dcnm_roles.yaml + echo "- hosts: dcnm" >> dcnm_roles.yaml + echo " gather_facts: no" >> dcnm_roles.yaml + echo " connection: ansible.netcommon.httpapi" >> dcnm_roles.yaml + echo " " >> dcnm_roles.yaml + echo " tasks:" >> dcnm_roles.yaml + echo " " >> dcnm_roles.yaml + echo " vars:" >> dcnm_roles.yaml + echo " debug: false" >> dcnm_roles.yaml + echo " " >> dcnm_roles.yaml + echo " roles:" >> dcnm_roles.yaml + echo " - dcnm_$MODULENAME" >> dcnm_roles.yaml + + cat dcnm_roles.yaml + + # ansible-test sanity --docker --python << parameters.py_version >> -v --color --truncate 0 environment: PYTHONPATH: /home/circleci/.ansible/collections/:$PYTHONPATH From 80b6aa58335323ffb8a483b290c67c9a9fd9fe34 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 13:05:05 +0530 Subject: [PATCH 131/248] Updated config.yml --- .circleci/config.yml | 231 +++++++++++++------------------------------ 1 file changed, 70 insertions(+), 161 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 576fcd033..1d993ddd3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,6 +54,7 @@ parameters: type: boolean default: false + jobs: build: parameters: @@ -67,6 +68,23 @@ jobs: steps: - checkout + - run: + name: Create Roles File header + command: | + echo "---" > dcnm_roles.yaml + echo "- hosts: dcnm" >> dcnm_roles.yaml + echo " gather_facts: no" >> dcnm_roles.yaml + echo " connection: ansible.netcommon.httpapi" >> dcnm_roles.yaml + echo " " >> dcnm_roles.yaml + echo " tasks:" >> dcnm_roles.yaml + echo " " >> dcnm_roles.yaml + echo " vars:" >> dcnm_roles.yaml + echo " debug: false" >> dcnm_roles.yaml + echo " " >> dcnm_roles.yaml + echo " roles:" >> dcnm_roles.yaml + + cat dcnm_roles.yaml + - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball command: | @@ -98,12 +116,28 @@ jobs: pip install coverage==4.5.4 pyenv local system - sanity: + addrole: parameters: - ansible_version: - type: string modulename: type: string + + working_directory: ~/repo + machine: true + resource_class: cisco/ansible-dcnm + + steps: + - checkout + + - run: + name: Adding role- << parameters.modulename >> + command: | + export MODULENAME="<< parameters.modulename >>" + echo " - dcnm_$MODULENAME" >> dcnm_roles.yaml + + sanity-tests: + parameters: + ansible_version: + type: string py_version: type: string @@ -115,7 +149,7 @@ jobs: - checkout - run: - name: Activating Python << parameters.py_version >> env for << parameters.modulename >> + name: Activating Python << parameters.py_version >> env command: | export PYENV_ROOT="/home/circleci/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" @@ -126,21 +160,9 @@ jobs: export PATH="/home/circleci/.ansible/collections/:$PATH" export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" - export MODULENAME="<< parameters.modulename >>" + pyenv local python_<< parameters.py_version >> - - echo "---" > dcnm_roles.yaml - echo "- hosts: dcnm" >> dcnm_roles.yaml - echo " gather_facts: no" >> dcnm_roles.yaml - echo " connection: ansible.netcommon.httpapi" >> dcnm_roles.yaml - echo " " >> dcnm_roles.yaml - echo " tasks:" >> dcnm_roles.yaml - echo " " >> dcnm_roles.yaml - echo " vars:" >> dcnm_roles.yaml - echo " debug: false" >> dcnm_roles.yaml - echo " " >> dcnm_roles.yaml - echo " roles:" >> dcnm_roles.yaml - echo " - dcnm_$MODULENAME" >> dcnm_roles.yaml + cat dcnm_roles.yaml @@ -163,19 +185,10 @@ jobs: ansible --version ansible-galaxy collection install --force ${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs/*.tar.gz - - run: - name: Run DCNM Unit tests for << parameters.modulename >> - # cd /home/circleci/.ansible/collections/ansible_collections/cisco/dcnm - command: | - ls -lrt - export PATH="/home/circleci/.ansible/collections/:$PATH" - export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" - echo $PATH - echo $PYTHONPATH - coverage run --source=. -m pytest tests/unit/modules/dcnm/test_dcnm_<< parameters.modulename >>.py -vvvv + - run: - name: Run sanity tests py << parameters.py_version >> for << parameters.modulename >> + name: Run sanity tests py << parameters.py_version >> command: echo done # command: ansible-test sanity --python 3.8 -v --color --truncate 0 # environment: @@ -329,133 +342,72 @@ workflows: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-interface >> jobs: - - sanity: - + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - interface - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 - # - interface_job + inventory: when: or: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-inventory >> jobs: - - sanity: - + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - inventory - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 - # - inventory_job + vrf: when: or: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-vrf >> jobs: - - sanity: - + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - vrf - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 + links: when: or: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-links >> jobs: - - sanity: + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - links - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 + network: when: or: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-network >> jobs: - - sanity: - + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - network - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 + policy: when: or: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-policy >> jobs: - - sanity: + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - policy - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 resource_manager: when: @@ -463,22 +415,11 @@ workflows: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-resource_manager >> jobs: - - sanity: - + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - resource_manager - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 service_node: when: @@ -486,22 +427,13 @@ workflows: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-service_node >> jobs: - - sanity: + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - service_node - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 + service_policy: when: @@ -509,22 +441,13 @@ workflows: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-service_policy >> jobs: - - sanity: + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - service_policy - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 + service_route_peering: @@ -533,22 +456,12 @@ workflows: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-service_route_peering >> jobs: - - sanity: + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - service_route_peering - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 template: when: @@ -556,22 +469,12 @@ workflows: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-template >> jobs: - - sanity: + - addrole: matrix: parameters: - py_version: - - "3.8" - - "3.9" modulename: - template - ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 - - 2.13.8 - # - 2.14.2 rest: when: @@ -579,15 +482,22 @@ workflows: - << pipeline.parameters.run-all >> - << pipeline.parameters.run-rest >> jobs: - - sanity: + - addrole: + matrix: + parameters: + modulename: + - rest + + + sanity: + jobs: + - sanity-tests: matrix: parameters: py_version: - "3.8" - "3.9" - modulename: - - rest ansible_version: - 2.9.26 - 2.10.17 @@ -597,4 +507,3 @@ workflows: # - 2.14.2 - From 975755f732ed578507d39b37a42e1a87a9a9c8cb Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 14:36:05 +0530 Subject: [PATCH 132/248] Updated config.yml --- .circleci/config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1d993ddd3..bdfc83eb6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,6 +53,9 @@ parameters: run-all: type: boolean default: false + run-any: + type: boolean + default: false jobs: @@ -271,6 +274,7 @@ workflows: # 3-column space-separated table for mapping; `path-to-test parameter-to-set value-for-parameter` for each row mapping: | .* run-setup false + .* run-any true plugins/httpapi/.* run-all true plugins/module_utils/.* run-all true plugins/action/dcnm_interface.py run-interface true @@ -491,6 +495,7 @@ workflows: sanity: + when: << pipeline.parameters.run-any >> jobs: - sanity-tests: matrix: From f96e2629fc5834753416ae6ab1e58be8d68a7cc7 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 14:48:56 +0530 Subject: [PATCH 133/248] Updated config.yml --- .circleci/config.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bdfc83eb6..278dc6e68 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,6 +87,11 @@ jobs: echo " roles:" >> dcnm_roles.yaml cat dcnm_roles.yaml + - run: + name: Copy static files + command: | + cp /home/circleci/static/dcnm.yaml dcnm.yaml + cp /home/circleci/static/hosts hosts - run: name: Activate Python 3.9 Environment, Install ansible and Build collection tarball @@ -192,7 +197,7 @@ jobs: - run: name: Run sanity tests py << parameters.py_version >> - command: echo done + command: ansible-playbook -i hosts dcnm_vrf.yaml -vvvv # command: ansible-test sanity --python 3.8 -v --color --truncate 0 # environment: # PYTHONPATH: /home/circleci/.ansible/collections/ From 0827a6067c168ff61e1a532177682afc1ac726a1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 14:53:58 +0530 Subject: [PATCH 134/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 278dc6e68..42eeae981 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -197,7 +197,7 @@ jobs: - run: name: Run sanity tests py << parameters.py_version >> - command: ansible-playbook -i hosts dcnm_vrf.yaml -vvvv + command: ansible-playbook -i hosts dcnm_roles.yaml -vvvv # command: ansible-test sanity --python 3.8 -v --color --truncate 0 # environment: # PYTHONPATH: /home/circleci/.ansible/collections/ From 5e71479f0f1806afd29afa592d3b9aa84a3730e5 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:03:17 +0530 Subject: [PATCH 135/248] Updated config.yml --- .circleci/config.yml | 70 ++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 42eeae981..c9e2c3f39 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -262,10 +262,10 @@ workflows: matrix: parameters: ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 + # - 2.9.26 + # - 2.10.17 + # - 2.11.12 + # - 2.12.10 - 2.13.8 # - 2.14.2 @@ -333,78 +333,78 @@ workflows: matrix: parameters: py_version: - - "3.8" + # - "3.8" - "3.9" ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 + # - 2.9.26 + # - 2.10.17 + # - 2.11.12 + # - 2.12.10 - 2.13.8 # - 2.14.2 - - interface: - when: + vrf: + when: or: - << pipeline.parameters.run-all >> - - << pipeline.parameters.run-interface >> + - << pipeline.parameters.run-vrf >> jobs: - addrole: matrix: parameters: modulename: - - interface + - vrf - inventory: - when: + links: + when: or: - << pipeline.parameters.run-all >> - - << pipeline.parameters.run-inventory >> + - << pipeline.parameters.run-links >> jobs: - addrole: + matrix: parameters: modulename: - - inventory + - links - vrf: + network: when: or: - << pipeline.parameters.run-all >> - - << pipeline.parameters.run-vrf >> + - << pipeline.parameters.run-network >> jobs: - addrole: matrix: parameters: modulename: - - vrf + - network - links: - when: + + interface: + when: or: - << pipeline.parameters.run-all >> - - << pipeline.parameters.run-links >> + - << pipeline.parameters.run-interface >> jobs: - addrole: - matrix: parameters: modulename: - - links + - interface - network: - when: + inventory: + when: or: - << pipeline.parameters.run-all >> - - << pipeline.parameters.run-network >> + - << pipeline.parameters.run-inventory >> jobs: - addrole: matrix: parameters: modulename: - - network + - inventory policy: when: @@ -506,13 +506,13 @@ workflows: matrix: parameters: py_version: - - "3.8" + # - "3.8" - "3.9" ansible_version: - - 2.9.26 - - 2.10.17 - - 2.11.12 - - 2.12.10 + # - 2.9.26 + # - 2.10.17 + # - 2.11.12 + # - 2.12.10 - 2.13.8 # - 2.14.2 From 508ed082d5e535cdb5446dd32d3a7294ea43c72c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:14:29 +0530 Subject: [PATCH 136/248] Updated config.yml --- .circleci/config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index c9e2c3f39..2829662dc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -169,10 +169,14 @@ jobs: export PATH="/home/circleci/.ansible/collections/:$PATH" export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" + export ANSIBLE_ROLES_PATH=/home/circleci/repo/tests/integration/targets + pyenv local python_<< parameters.py_version >> cat dcnm_roles.yaml + + # ansible-test sanity --docker --python << parameters.py_version >> -v --color --truncate 0 @@ -230,6 +234,7 @@ jobs: export PATH="/home/circleci/.ansible/collections/:$PATH" export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" + pyenv local python_<< parameters.py_version >> From 0f9bf591903f5ddee0847ff17a7ef5655d40034a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:20:09 +0530 Subject: [PATCH 137/248] Updated config.yml --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2829662dc..2cb3071d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -201,7 +201,9 @@ jobs: - run: name: Run sanity tests py << parameters.py_version >> - command: ansible-playbook -i hosts dcnm_roles.yaml -vvvv + command: | + env + ansible-playbook -i hosts dcnm_roles.yaml -vvvv # command: ansible-test sanity --python 3.8 -v --color --truncate 0 # environment: # PYTHONPATH: /home/circleci/.ansible/collections/ From 08c43283aafb85a558df31b22b7f6bb3d9b286d2 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:24:54 +0530 Subject: [PATCH 138/248] Updated config.yml --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2cb3071d2..a8359a7b1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -169,8 +169,6 @@ jobs: export PATH="/home/circleci/.ansible/collections/:$PATH" export PYTHONPATH="/home/circleci/.ansible/collections/:$PYTHONPATH" - export ANSIBLE_ROLES_PATH=/home/circleci/repo/tests/integration/targets - pyenv local python_<< parameters.py_version >> @@ -202,6 +200,7 @@ jobs: - run: name: Run sanity tests py << parameters.py_version >> command: | + export ANSIBLE_ROLES_PATH=/home/circleci/repo/tests/integration/targets env ansible-playbook -i hosts dcnm_roles.yaml -vvvv # command: ansible-test sanity --python 3.8 -v --color --truncate 0 From 147940a81878417f0b740602576033a7f420878b Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:26:12 +0530 Subject: [PATCH 139/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a8359a7b1..a0763e2ef 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -200,7 +200,7 @@ jobs: - run: name: Run sanity tests py << parameters.py_version >> command: | - export ANSIBLE_ROLES_PATH=/home/circleci/repo/tests/integration/targets + export ANSIBLE_ROLES_PATH=/home/circleci/repo/tests/integration/targets/ env ansible-playbook -i hosts dcnm_roles.yaml -vvvv # command: ansible-test sanity --python 3.8 -v --color --truncate 0 From 6b2d284a89a4d36bff011910e7ed109df3a625a5 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 11 Jul 2023 14:37:41 +0530 Subject: [PATCH 140/248] Updated config.yml --- .circleci/config.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a0763e2ef..efe3c62ef 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -272,8 +272,9 @@ workflows: # - 2.10.17 # - 2.11.12 # - 2.12.10 - - 2.13.8 + # - 2.13.8 # - 2.14.2 + - 2.14.4 - path-filtering/filter: requires: @@ -346,8 +347,8 @@ workflows: # - 2.10.17 # - 2.11.12 # - 2.12.10 - - 2.13.8 - # - 2.14.2 + # - 2.13.8 + - 2.14.4 vrf: @@ -519,7 +520,7 @@ workflows: # - 2.10.17 # - 2.11.12 # - 2.12.10 - - 2.13.8 - # - 2.14.2 + # - 2.13.8 + - 2.14.4 From b0ff689f2e7766efd74e1f4493cf87ac88d80284 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 11 Jul 2023 14:41:46 +0530 Subject: [PATCH 141/248] Updated config.yml --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index efe3c62ef..6f948f387 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,7 +90,8 @@ jobs: - run: name: Copy static files command: | - cp /home/circleci/static/dcnm.yaml dcnm.yaml + mkdir group_vars + cp /home/circleci/static/dcnm.yaml group_vars/dcnm.yaml cp /home/circleci/static/hosts hosts - run: From b89b7f64c0c63fa3b3a4a8db10921c4ea54a944e Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 11 Jul 2023 15:08:16 +0530 Subject: [PATCH 142/248] Updated config.yml --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6f948f387..598537a4b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -275,7 +275,7 @@ workflows: # - 2.12.10 # - 2.13.8 # - 2.14.2 - - 2.14.4 + - 2.13.6 - path-filtering/filter: requires: @@ -349,7 +349,7 @@ workflows: # - 2.11.12 # - 2.12.10 # - 2.13.8 - - 2.14.4 + - 2.13.6 vrf: @@ -522,6 +522,6 @@ workflows: # - 2.11.12 # - 2.12.10 # - 2.13.8 - - 2.14.4 + - 2.13.6 From 14c178e02504cf4127269f88019b099d9f6df328 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 18:06:34 +0530 Subject: [PATCH 143/248] Updated config.yml --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 598537a4b..40b1ce067 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -342,7 +342,7 @@ workflows: parameters: py_version: # - "3.8" - - "3.9" + - "3.11" ansible_version: # - 2.9.26 # - 2.10.17 @@ -515,7 +515,7 @@ workflows: parameters: py_version: # - "3.8" - - "3.9" + - "3.11" ansible_version: # - 2.9.26 # - 2.10.17 From cf77436c74b5074d13c628b012e74c43115fe8df Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 18:13:40 +0530 Subject: [PATCH 144/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 40b1ce067..097d952ad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,7 +90,7 @@ jobs: - run: name: Copy static files command: | - mkdir group_vars + cp /home/circleci/static/dcnm.yaml group_vars/dcnm.yaml cp /home/circleci/static/hosts hosts From 4bb42f684f0c3166385eaf76c73d3be733f0223c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 18:23:09 +0530 Subject: [PATCH 145/248] Updated config.yml --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 097d952ad..8ff33d560 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,5 +1,4 @@ version: 2.1 - setup: << pipeline.parameters.run-setup >> orbs: From 4c5513eb2bb3ef5098ba682b0c1e753965762c2f Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 18:55:36 +0530 Subject: [PATCH 146/248] Updated config.yml --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8ff33d560..eef65a103 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -94,7 +94,7 @@ jobs: cp /home/circleci/static/hosts hosts - run: - name: Activate Python 3.9 Environment, Install ansible and Build collection tarball + name: Activate Python 3.11 Environment, Install ansible and Build collection tarball command: | export PYENV_ROOT="/home/circleci/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" @@ -110,13 +110,13 @@ jobs: # echo $HOME # echo $PYENV_ROOT # echo "**********************" - /home/circleci/.pyenv/bin/pyenv local python_3.9 + pyenv local python_3.11 # /home/circleci/.pyenv/bin/pyenv versions # /home/circleci/.pyenv/shims/python --version # python3 --version # python --version - pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check + #pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible --version pyenv versions ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" From c0033b7bbb750684f94fe843dbc5826a1fbf4852 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 18:59:18 +0530 Subject: [PATCH 147/248] Update main.yaml --- tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml index a52b880b3..42229bd32 100644 --- a/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml @@ -59,7 +59,6 @@ ############################################## - name: Create templates - tags: sanity cisco.dcnm.dcnm_template: &temp_merge state: merged # only choose form [merged, deleted, query] config: @@ -148,6 +147,8 @@ dst-grp 5 snsr-grp 5 sample-interval 50000 register: result + tags: sanity + - assert: that: - 'result.changed == true' From b6d4a144acd18b6758f35792beae413c565f808d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 19:02:20 +0530 Subject: [PATCH 148/248] Update main.yaml --- tests/integration/targets/prepare_dcnm_intf/tasks/main.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/prepare_dcnm_intf/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_intf/tasks/main.yaml index ee4e24460..4c17a1169 100644 --- a/tests/integration/targets/prepare_dcnm_intf/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_intf/tasks/main.yaml @@ -25,6 +25,7 @@ ## register: result + tags: sanity # Create the policy to deploy interface-vlan and hsrp features on the switches - name: Create interface-vlan and hsrp policies @@ -43,4 +44,5 @@ - ip: "{{ ansible_switch2 }}" deploy: true state: merged - register: result \ No newline at end of file + register: result + tags: sanity From 5f5bbf6e8cba821d5d59c87985f0e0109e7a0fe9 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 19:05:16 +0530 Subject: [PATCH 149/248] Update sanity.yml --- .../targets/dcnm_service_policy/tests/dcnm/sanity.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml index bc693e647..e172a2acb 100644 --- a/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml @@ -4,7 +4,7 @@ - name: Remove local log file local_action: command rm -f sp.log - tags: sanity + #tags: sanity - name: Delete service policies cisco.dcnm.dcnm_service_policy: &dcnm_sp_del_all @@ -27,16 +27,16 @@ - name: service_policy_5 # mandatory node_name: "{{ ansible_snode_2 }}" # mandatory register: result - tags: sanity + #tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - tags: sanity + #tags: sanity -- tags: sanity - block: + #tags: sanity +- block: ############################################## ## MERGE ## From 103ce5d5b027907f0ecae88dc4a61f1beda94383 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 19:22:53 +0530 Subject: [PATCH 150/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eef65a103..132509407 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -202,7 +202,7 @@ jobs: command: | export ANSIBLE_ROLES_PATH=/home/circleci/repo/tests/integration/targets/ env - ansible-playbook -i hosts dcnm_roles.yaml -vvvv + ansible-playbook -i hosts dcnm_roles.yaml --tags sanity -vvvv # command: ansible-test sanity --python 3.8 -v --color --truncate 0 # environment: # PYTHONPATH: /home/circleci/.ansible/collections/ From 8745595c8be07b58eab521bb30c09415ea3907d2 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 20:18:50 +0530 Subject: [PATCH 151/248] Update dcnm.yaml --- tests/integration/targets/dcnm_interface/tasks/dcnm.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/integration/targets/dcnm_interface/tasks/dcnm.yaml b/tests/integration/targets/dcnm_interface/tasks/dcnm.yaml index e42041ea1..137192e7a 100644 --- a/tests/integration/targets/dcnm_interface/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_interface/tasks/dcnm.yaml @@ -5,19 +5,23 @@ patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases + tags: sanity - 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 }}" + tags: sanity - name: run test cases (connection=httpapi) include: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + tags: sanity - name: Final Cleanup - delete feature_interface_vlan and hsrp policies that we created during init cisco.dcnm.dcnm_policy: @@ -30,11 +34,13 @@ - ip: "{{ ansible_switch1 }}" - ip: "{{ ansible_switch2 }}" register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: Final Cleanup - delete all templates created during init cisco.dcnm.dcnm_template: @@ -43,8 +49,10 @@ - name: my_interface_vlan - name: my_hsrp register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity From ddd617eedf0556eb8a71e4c82dec35a7f4f2596d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 20:20:38 +0530 Subject: [PATCH 152/248] Update main.yaml --- tests/integration/targets/dcnm_inventory/tasks/main.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_inventory/tasks/main.yaml b/tests/integration/targets/dcnm_inventory/tasks/main.yaml index 8f9b4f34d..50acca329 100644 --- a/tests/integration/targets/dcnm_inventory/tasks/main.yaml +++ b/tests/integration/targets/dcnm_inventory/tasks/main.yaml @@ -2,6 +2,7 @@ - set_fact: controller_version: "Unable to determine controller version" + tags: sanity - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: @@ -9,11 +10,13 @@ path: /appcenter/cisco/ndfc/api/about/version register: result ignore_errors: yes + tags: sanity - set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) ignore_errors: yes + tags: sanity - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: @@ -21,15 +24,19 @@ path: /fm/fmrest/about/version register: result ignore_errors: yes + tags: sanity - set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) ignore_errors: yes + tags: sanity # No need to continue if we cannot determine the DCNM/NDFC controller version - assert: that: - 'controller_version != "Unable to determine controller version"' + tags: sanity -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- { include: dcnm.yaml, tags: ['dcnm'] } + tags: sanity From 0f1bd1584c41ed75224b16cbb5c3e99cd9daf591 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 20:21:13 +0530 Subject: [PATCH 153/248] Update main.yaml --- tests/integration/targets/dcnm_interface/tasks/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/targets/dcnm_interface/tasks/main.yaml b/tests/integration/targets/dcnm_interface/tasks/main.yaml index c072f092c..716c6ba46 100644 --- a/tests/integration/targets/dcnm_interface/tasks/main.yaml +++ b/tests/integration/targets/dcnm_interface/tasks/main.yaml @@ -1,2 +1,3 @@ --- - { include: dcnm.yaml, tags: ['dcnm','sanity'] } + tags: sanity From d8575ac5799d0f4fcf58d518333bde511b0baa35 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 20:22:10 +0530 Subject: [PATCH 154/248] Update dcnm.yaml --- tests/integration/targets/dcnm_inventory/tasks/dcnm.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integration/targets/dcnm_inventory/tasks/dcnm.yaml b/tests/integration/targets/dcnm_inventory/tasks/dcnm.yaml index 881b81cb6..7ddd90461 100644 --- a/tests/integration/targets/dcnm_inventory/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_inventory/tasks/dcnm.yaml @@ -5,16 +5,20 @@ patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases + tags: sanity - 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 }}" + tags: sanity - name: run test cases (connection=httpapi) include: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + tags: sanity From 96f1d987df0dba8c9f95a5938ad1987bb0fb398d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 12 Jul 2023 20:24:35 +0530 Subject: [PATCH 155/248] Update main.yaml --- tests/integration/targets/dcnm_links/tasks/main.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_links/tasks/main.yaml b/tests/integration/targets/dcnm_links/tasks/main.yaml index 78c5fb834..4ab3f31d3 100644 --- a/tests/integration/targets/dcnm_links/tasks/main.yaml +++ b/tests/integration/targets/dcnm_links/tasks/main.yaml @@ -1,2 +1,3 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- { include: dcnm.yaml, tags: ['dcnm'] } + tags: sanity From c0ceaa6e2c75d770f81e213c9842185de0d81c5d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 08:55:59 +0530 Subject: [PATCH 156/248] Update dcnm.yaml --- tests/integration/targets/dcnm_links/tasks/dcnm.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integration/targets/dcnm_links/tasks/dcnm.yaml b/tests/integration/targets/dcnm_links/tasks/dcnm.yaml index 881b81cb6..5eaa5c4cb 100644 --- a/tests/integration/targets/dcnm_links/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_links/tasks/dcnm.yaml @@ -5,16 +5,20 @@ patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases + tags: sanity - 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 }}" + tags: sanity - name: run test cases (connection=httpapi) include: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + tags: sanity From 149434bff74f63269f5c0e4e39c16d06d118ecc6 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 08:59:07 +0530 Subject: [PATCH 157/248] Update dcnm.yaml --- tests/integration/targets/dcnm_network/tasks/dcnm.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integration/targets/dcnm_network/tasks/dcnm.yaml b/tests/integration/targets/dcnm_network/tasks/dcnm.yaml index 59de4568f..a13eb3a0b 100644 --- a/tests/integration/targets/dcnm_network/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_network/tasks/dcnm.yaml @@ -5,16 +5,20 @@ patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases + tags: sanity - 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 }}" + tags: sanity - name: run test cases (connection=httpapi) include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + tags: sanity From 5b6af63f9bb78319054f3dc01710efe8f71f5e44 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 09:00:25 +0530 Subject: [PATCH 158/248] Update main.yaml --- tests/integration/targets/dcnm_network/tasks/main.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/integration/targets/dcnm_network/tasks/main.yaml b/tests/integration/targets/dcnm_network/tasks/main.yaml index 284fb30ad..2e861d4ce 100644 --- a/tests/integration/targets/dcnm_network/tasks/main.yaml +++ b/tests/integration/targets/dcnm_network/tasks/main.yaml @@ -2,6 +2,7 @@ - set_fact: controller_version: "Unable to determine controller version" + tags: sanity - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: @@ -9,11 +10,13 @@ path: /appcenter/cisco/ndfc/api/about/version register: result ignore_errors: yes + tags: sanity - set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) ignore_errors: yes + tags: sanity - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: @@ -21,21 +24,25 @@ path: /fm/fmrest/about/version register: result ignore_errors: yes + tags: sanity - set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) ignore_errors: yes + tags: sanity # No need to continue if we cannot determine the DCNM/NDFC controller version - assert: that: - 'controller_version != "Unable to determine controller version"' + tags: sanity - name: Remove all existing networks to start with a clean state cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: deleted + tags: sanity - name: Create vrfs required for this test and remove all other vrfs cisco.dcnm.dcnm_vrf: @@ -63,5 +70,7 @@ - ip_address: "{{ ansible_switch1 }}" - ip_address: "{{ ansible_switch2 }}" deploy: true + tags: sanity - { include_tasks: dcnm.yaml, tags: ['dcnm'] } + tags: sanity From 0b4a6dac37bcbb7cbca2627df2bde5886ac64aa9 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 09:00:58 +0530 Subject: [PATCH 159/248] Update main.yaml --- tests/integration/targets/dcnm_policy/tasks/main.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_policy/tasks/main.yaml b/tests/integration/targets/dcnm_policy/tasks/main.yaml index 78c5fb834..b14bb3bf5 100644 --- a/tests/integration/targets/dcnm_policy/tasks/main.yaml +++ b/tests/integration/targets/dcnm_policy/tasks/main.yaml @@ -1,2 +1,3 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- { include: dcnm.yaml, tags: ['dcnm'] } + tags: sanity From 2b2a417614d9c4d7820d080f581eb1547c61a868 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 09:01:46 +0530 Subject: [PATCH 160/248] Update dcnm.yaml --- tests/integration/targets/dcnm_policy/tasks/dcnm.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_policy/tasks/dcnm.yaml b/tests/integration/targets/dcnm_policy/tasks/dcnm.yaml index 9e606ce8e..4be161497 100644 --- a/tests/integration/targets/dcnm_policy/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_policy/tasks/dcnm.yaml @@ -5,19 +5,23 @@ patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases + tags: sanity - 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 }}" + tags: sanity - name: run test cases (connection=httpapi) include: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + tags: sanity - name: Final Cleanup - delete telemetry policy that we created during init cisco.dcnm.dcnm_policy: @@ -30,11 +34,13 @@ - ip: "{{ ansible_switch1 }}" - ip: "{{ ansible_switch2 }}" register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: Final Cleanup - delete all templates created during init cisco.dcnm.dcnm_template: @@ -47,10 +53,11 @@ - name: template_105 - name: my_base_ospf - name: my_feature_telemetry + tags: sanity register: result - assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' \ No newline at end of file + loop: '{{ result.response }}' From 31fcdb7951faf2fed3ba923562b31f105d3d0225 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 10:33:47 +0530 Subject: [PATCH 161/248] Update dcnm.yaml --- .../integration/targets/dcnm_resource_manager/tasks/dcnm.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integration/targets/dcnm_resource_manager/tasks/dcnm.yaml b/tests/integration/targets/dcnm_resource_manager/tasks/dcnm.yaml index 881b81cb6..5eaa5c4cb 100644 --- a/tests/integration/targets/dcnm_resource_manager/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tasks/dcnm.yaml @@ -5,16 +5,20 @@ patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases + tags: sanity - 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 }}" + tags: sanity - name: run test cases (connection=httpapi) include: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + tags: sanity From d39549bd193df3e2ac5dc6b1d5de5cd93af118cf Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 10:34:47 +0530 Subject: [PATCH 162/248] Update main.yaml --- .../integration/targets/dcnm_resource_manager/tasks/main.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml b/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml index 78c5fb834..b14bb3bf5 100644 --- a/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml @@ -1,2 +1,3 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- { include: dcnm.yaml, tags: ['dcnm'] } + tags: sanity From c7d74869d18cae835b30e249e0b14125e0db04be Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 10:36:32 +0530 Subject: [PATCH 163/248] Update dcnm.yaml --- tests/integration/targets/dcnm_service_node/tasks/dcnm.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_service_node/tasks/dcnm.yaml b/tests/integration/targets/dcnm_service_node/tasks/dcnm.yaml index 7081e21b6..34ebc4f2d 100644 --- a/tests/integration/targets/dcnm_service_node/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_service_node/tasks/dcnm.yaml @@ -5,16 +5,20 @@ patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases + tags: sanity - 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 }}" + tags: sanity - name: run test cases (connection=httpapi) include: "{{ test_case_to_run }} ansible_connection=httpapi connection={{ dcnm }}" with_items: "{{ test_items }}" loop_control: - loop_var: test_case_to_run \ No newline at end of file + loop_var: test_case_to_run + tags: sanity From 0b746a63e1f19612b64b674451ef618b044c2cba Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 10:37:16 +0530 Subject: [PATCH 164/248] Update main.yaml --- .../integration/targets/dcnm_service_node/tasks/main.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/integration/targets/dcnm_service_node/tasks/main.yaml b/tests/integration/targets/dcnm_service_node/tasks/main.yaml index 24cf008f3..424b2e22b 100644 --- a/tests/integration/targets/dcnm_service_node/tasks/main.yaml +++ b/tests/integration/targets/dcnm_service_node/tasks/main.yaml @@ -2,6 +2,7 @@ - set_fact: controller_version: "Unable to determine controller version" + tags: sanity - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: @@ -9,11 +10,13 @@ path: /appcenter/cisco/ndfc/api/about/version register: result ignore_errors: yes + tags: sanity - set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) ignore_errors: yes + tags: sanity - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: @@ -21,15 +24,19 @@ path: /fm/fmrest/about/version register: result ignore_errors: yes + tags: sanity - set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) ignore_errors: yes + tags: sanity # No need to continue if we cannot determine the DCNM/NDFC controller version - assert: that: - 'controller_version != "Unable to determine controller version"' + tags: sanity - { include: dcnm.yaml, tags: ['dcnm'] } + tags: sanity From 29930c1d6b8810855fc87c43c1440610c9e6195a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 10:37:51 +0530 Subject: [PATCH 165/248] Update main.yaml --- tests/integration/targets/dcnm_template/tasks/main.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_template/tasks/main.yaml b/tests/integration/targets/dcnm_template/tasks/main.yaml index 78c5fb834..b14bb3bf5 100644 --- a/tests/integration/targets/dcnm_template/tasks/main.yaml +++ b/tests/integration/targets/dcnm_template/tasks/main.yaml @@ -1,2 +1,3 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- { include: dcnm.yaml, tags: ['dcnm'] } + tags: sanity From ab5387b7fb5eb19d2f37dd755d5dfe7c4fe71944 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:42:02 +0530 Subject: [PATCH 166/248] Update dcnm.yaml --- .../integration/targets/dcnm_template/tasks/dcnm.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_template/tasks/dcnm.yaml b/tests/integration/targets/dcnm_template/tasks/dcnm.yaml index ab505bd77..a142c359a 100644 --- a/tests/integration/targets/dcnm_template/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_template/tasks/dcnm.yaml @@ -5,19 +5,23 @@ patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases + tags: sanity - 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 }}" + tags: sanity - name: run test cases (connection=httpapi) include: "{{ 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 cisco.dcnm.dcnm_policy: @@ -30,11 +34,13 @@ - switch: - ip: "{{ ansible_switch1 }}" register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: Final cleanup - delete all templates created during init cisco.dcnm.dcnm_template: @@ -43,10 +49,11 @@ - name: template_inuse_1 - name: template_inuse_2 - name: my_feature_telemetry - + tags: sanity register: result - assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' \ No newline at end of file + loop: '{{ result.response }}' + tags: sanity From dce8dbc289f7c81e5d80ed286130acda5747ad1d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:46:38 +0530 Subject: [PATCH 167/248] Update dcnm.yaml --- tests/integration/targets/dcnm_vrf/tasks/dcnm.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_vrf/tasks/dcnm.yaml b/tests/integration/targets/dcnm_vrf/tasks/dcnm.yaml index 7081e21b6..403319bc6 100644 --- a/tests/integration/targets/dcnm_vrf/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_vrf/tasks/dcnm.yaml @@ -5,16 +5,20 @@ patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases + tags: sanity - 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 }}" + tags: sanity - name: run test cases (connection=httpapi) include: "{{ test_case_to_run }} ansible_connection=httpapi connection={{ dcnm }}" with_items: "{{ test_items }}" loop_control: - loop_var: test_case_to_run \ No newline at end of file + loop_var: test_case_to_run + tags: sanity From a6d5b5d1556419f9d722b127954a2d2668e80765 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:47:36 +0530 Subject: [PATCH 168/248] Update main.yaml --- tests/integration/targets/dcnm_vrf/tasks/main.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/integration/targets/dcnm_vrf/tasks/main.yaml b/tests/integration/targets/dcnm_vrf/tasks/main.yaml index 24cf008f3..4fc3ead41 100644 --- a/tests/integration/targets/dcnm_vrf/tasks/main.yaml +++ b/tests/integration/targets/dcnm_vrf/tasks/main.yaml @@ -2,6 +2,7 @@ - set_fact: controller_version: "Unable to determine controller version" + tags: sanity - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: @@ -9,6 +10,7 @@ path: /appcenter/cisco/ndfc/api/about/version register: result ignore_errors: yes + tags: sanity - set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" @@ -21,15 +23,19 @@ path: /fm/fmrest/about/version register: result ignore_errors: yes + tags: sanity - set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) ignore_errors: yes + tags: sanity # No need to continue if we cannot determine the DCNM/NDFC controller version - assert: that: - 'controller_version != "Unable to determine controller version"' + tags: sanity - { include: dcnm.yaml, tags: ['dcnm'] } + tags: sanity From dfe26617b7e967eb9348162638b8455e249f3db5 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:28:01 +0530 Subject: [PATCH 169/248] Updated config.yml --- .circleci/config.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 132509407..d2e41de76 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,9 +28,9 @@ parameters: run-resource_manager: type: boolean default: false - run-rest: - type: boolean - default: false +# run-rest: +# type: boolean +# default: false run-service_node: type: boolean default: false @@ -492,18 +492,18 @@ workflows: modulename: - template - rest: - when: - or: - - << pipeline.parameters.run-all >> - - << pipeline.parameters.run-rest >> - jobs: - - addrole: - - matrix: - parameters: - modulename: - - rest +# rest: +# when: +# or: +# - << pipeline.parameters.run-all >> +# - << pipeline.parameters.run-rest >> +# jobs: +# - addrole: +# +# matrix: +# parameters: +# modulename: +# - rest sanity: From ffe1ee447d9e11147683e6e2c585f8893563a3e1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:35:07 +0530 Subject: [PATCH 170/248] Update main.yaml --- tests/integration/targets/dcnm_interface/tasks/main.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration/targets/dcnm_interface/tasks/main.yaml b/tests/integration/targets/dcnm_interface/tasks/main.yaml index 716c6ba46..c072f092c 100644 --- a/tests/integration/targets/dcnm_interface/tasks/main.yaml +++ b/tests/integration/targets/dcnm_interface/tasks/main.yaml @@ -1,3 +1,2 @@ --- - { include: dcnm.yaml, tags: ['dcnm','sanity'] } - tags: sanity From 51739cd8f00b262dc354256e70e964e4d5c016cd Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:35:50 +0530 Subject: [PATCH 171/248] Update main.yaml --- tests/integration/targets/dcnm_inventory/tasks/main.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_inventory/tasks/main.yaml b/tests/integration/targets/dcnm_inventory/tasks/main.yaml index 50acca329..86f2164c5 100644 --- a/tests/integration/targets/dcnm_inventory/tasks/main.yaml +++ b/tests/integration/targets/dcnm_inventory/tasks/main.yaml @@ -38,5 +38,4 @@ - 'controller_version != "Unable to determine controller version"' tags: sanity -- { include: dcnm.yaml, tags: ['dcnm'] } - tags: sanity +- { include: dcnm.yaml, tags: ['dcnm','sanity'] } From 428bc9cf111f4a472848d46c33571ea56769fc08 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:37:19 +0530 Subject: [PATCH 172/248] Update main.yaml --- tests/integration/targets/dcnm_links/tasks/main.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_links/tasks/main.yaml b/tests/integration/targets/dcnm_links/tasks/main.yaml index 4ab3f31d3..c072f092c 100644 --- a/tests/integration/targets/dcnm_links/tasks/main.yaml +++ b/tests/integration/targets/dcnm_links/tasks/main.yaml @@ -1,3 +1,2 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } - tags: sanity +- { include: dcnm.yaml, tags: ['dcnm','sanity'] } From 3ff20909e1d7e2439ffe9a8b6f154527b344aba5 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:37:52 +0530 Subject: [PATCH 173/248] Update main.yaml --- tests/integration/targets/dcnm_network/tasks/main.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_network/tasks/main.yaml b/tests/integration/targets/dcnm_network/tasks/main.yaml index 2e861d4ce..1f1b39ce0 100644 --- a/tests/integration/targets/dcnm_network/tasks/main.yaml +++ b/tests/integration/targets/dcnm_network/tasks/main.yaml @@ -72,5 +72,4 @@ deploy: true tags: sanity -- { include_tasks: dcnm.yaml, tags: ['dcnm'] } - tags: sanity +- { include_tasks: dcnm.yaml, tags: ['dcnm','sanity'] } From c99d15478dbfe861ae76d78dba86fb9ff819a2e9 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:39:58 +0530 Subject: [PATCH 174/248] Update main.yaml --- tests/integration/targets/dcnm_policy/tasks/main.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_policy/tasks/main.yaml b/tests/integration/targets/dcnm_policy/tasks/main.yaml index b14bb3bf5..c072f092c 100644 --- a/tests/integration/targets/dcnm_policy/tasks/main.yaml +++ b/tests/integration/targets/dcnm_policy/tasks/main.yaml @@ -1,3 +1,2 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } - tags: sanity +- { include: dcnm.yaml, tags: ['dcnm','sanity'] } From c9dc02db8c170e03c28d278263212098781f8a2a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:40:20 +0530 Subject: [PATCH 175/248] Update main.yaml --- .../integration/targets/dcnm_resource_manager/tasks/main.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml b/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml index b14bb3bf5..c072f092c 100644 --- a/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml @@ -1,3 +1,2 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } - tags: sanity +- { include: dcnm.yaml, tags: ['dcnm','sanity'] } From 3514de514f0f9134856e4d352e0af59abaf87618 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:42:23 +0530 Subject: [PATCH 176/248] Update main.yaml --- tests/integration/targets/dcnm_service_node/tasks/main.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_service_node/tasks/main.yaml b/tests/integration/targets/dcnm_service_node/tasks/main.yaml index 424b2e22b..6f8dc6ee1 100644 --- a/tests/integration/targets/dcnm_service_node/tasks/main.yaml +++ b/tests/integration/targets/dcnm_service_node/tasks/main.yaml @@ -38,5 +38,4 @@ - 'controller_version != "Unable to determine controller version"' tags: sanity -- { include: dcnm.yaml, tags: ['dcnm'] } - tags: sanity +- { include: dcnm.yaml, tags: ['dcnm','sanity'] } From 8ef8269655c9dc96df94d0027a80250736d83a10 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:52:27 +0530 Subject: [PATCH 177/248] Update main.yaml --- tests/integration/targets/dcnm_template/tasks/main.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_template/tasks/main.yaml b/tests/integration/targets/dcnm_template/tasks/main.yaml index b14bb3bf5..c072f092c 100644 --- a/tests/integration/targets/dcnm_template/tasks/main.yaml +++ b/tests/integration/targets/dcnm_template/tasks/main.yaml @@ -1,3 +1,2 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } - tags: sanity +- { include: dcnm.yaml, tags: ['dcnm','sanity'] } From e2eb0c8ebee90f7de77bb0dcb418dbdaa160a502 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:52:58 +0530 Subject: [PATCH 178/248] Update main.yaml --- tests/integration/targets/dcnm_vrf/tasks/main.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_vrf/tasks/main.yaml b/tests/integration/targets/dcnm_vrf/tasks/main.yaml index 4fc3ead41..864e189fa 100644 --- a/tests/integration/targets/dcnm_vrf/tasks/main.yaml +++ b/tests/integration/targets/dcnm_vrf/tasks/main.yaml @@ -37,5 +37,4 @@ - 'controller_version != "Unable to determine controller version"' tags: sanity -- { include: dcnm.yaml, tags: ['dcnm'] } - tags: sanity +- { include: dcnm.yaml, tags: ['dcnm','sanity'] } From c6b1d441266aaa411042a50d2864cb058551780b Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:04:19 +0530 Subject: [PATCH 179/248] Update main.yaml --- tests/integration/targets/dcnm_interface/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_interface/tasks/main.yaml b/tests/integration/targets/dcnm_interface/tasks/main.yaml index c072f092c..4eb3337a2 100644 --- a/tests/integration/targets/dcnm_interface/tasks/main.yaml +++ b/tests/integration/targets/dcnm_interface/tasks/main.yaml @@ -1,2 +1,2 @@ --- -- { include: dcnm.yaml, tags: ['dcnm','sanity'] } +- { include: dcnm.yaml, tags: ['dcnm'] } From 37ebf279b8c7f86291007846a66769aac451a3c2 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:05:06 +0530 Subject: [PATCH 180/248] Update main.yaml --- tests/integration/targets/dcnm_inventory/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_inventory/tasks/main.yaml b/tests/integration/targets/dcnm_inventory/tasks/main.yaml index 86f2164c5..31595b581 100644 --- a/tests/integration/targets/dcnm_inventory/tasks/main.yaml +++ b/tests/integration/targets/dcnm_inventory/tasks/main.yaml @@ -38,4 +38,4 @@ - 'controller_version != "Unable to determine controller version"' tags: sanity -- { include: dcnm.yaml, tags: ['dcnm','sanity'] } +- { include: dcnm.yaml, tags: ['dcnm'] } From 1a32061f242a0f88ce2c4e9b694e0d1665d8a096 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:05:50 +0530 Subject: [PATCH 181/248] Update main.yaml --- tests/integration/targets/dcnm_links/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_links/tasks/main.yaml b/tests/integration/targets/dcnm_links/tasks/main.yaml index c072f092c..4eb3337a2 100644 --- a/tests/integration/targets/dcnm_links/tasks/main.yaml +++ b/tests/integration/targets/dcnm_links/tasks/main.yaml @@ -1,2 +1,2 @@ --- -- { include: dcnm.yaml, tags: ['dcnm','sanity'] } +- { include: dcnm.yaml, tags: ['dcnm'] } From 0299d392fc1fd461b66bd7df0e38107356dd153b Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:58:15 +0530 Subject: [PATCH 182/248] Rename sanity.yml to sanity.yaml --- .../targets/dcnm_interface/tests/dcnm/{sanity.yml => sanity.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/targets/dcnm_interface/tests/dcnm/{sanity.yml => sanity.yaml} (100%) diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml similarity index 100% rename from tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yml rename to tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml From b3e5e05580050f0c410087e22af5506f5c69e1e0 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:58:39 +0530 Subject: [PATCH 183/248] Rename sanity.yml to sanity.yaml --- .../targets/dcnm_inventory/tests/dcnm/{sanity.yml => sanity.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/targets/dcnm_inventory/tests/dcnm/{sanity.yml => sanity.yaml} (100%) diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml similarity index 100% rename from tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yml rename to tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml From bbb118a2a443014762ec8ffed18dec146651e42c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:25:34 +0530 Subject: [PATCH 184/248] Update main.yaml --- tests/integration/targets/dcnm_vrf/tasks/main.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_vrf/tasks/main.yaml b/tests/integration/targets/dcnm_vrf/tasks/main.yaml index 864e189fa..da3e8ee7a 100644 --- a/tests/integration/targets/dcnm_vrf/tasks/main.yaml +++ b/tests/integration/targets/dcnm_vrf/tasks/main.yaml @@ -16,6 +16,7 @@ controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) ignore_errors: yes + tags: sanity - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: @@ -37,4 +38,4 @@ - 'controller_version != "Unable to determine controller version"' tags: sanity -- { include: dcnm.yaml, tags: ['dcnm','sanity'] } +- { include: dcnm.yaml, tags: ['dcnm'] } From 0c708a85f54f2145a35497ef7466cc195bd06809 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:26:01 +0530 Subject: [PATCH 185/248] Rename sanity.yml to sanity.yaml --- .../targets/dcnm_vrf/tests/dcnm/{sanity.yml => sanity.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/targets/dcnm_vrf/tests/dcnm/{sanity.yml => sanity.yaml} (100%) diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml similarity index 100% rename from tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yml rename to tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml From 7c23618535ccffc4f4b846e595e636313ebee1ad Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:29:16 +0530 Subject: [PATCH 186/248] Rename sanity.yml to sanity.yaml --- .../targets/dcnm_template/tests/dcnm/{sanity.yml => sanity.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/targets/dcnm_template/tests/dcnm/{sanity.yml => sanity.yaml} (100%) diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml similarity index 100% rename from tests/integration/targets/dcnm_template/tests/dcnm/sanity.yml rename to tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml From 5a135b0bd6265bbecf566ca9f4a567bf3d91dd62 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:32:40 +0530 Subject: [PATCH 187/248] Update main.yaml --- tests/integration/targets/dcnm_template/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_template/tasks/main.yaml b/tests/integration/targets/dcnm_template/tasks/main.yaml index c072f092c..4eb3337a2 100644 --- a/tests/integration/targets/dcnm_template/tasks/main.yaml +++ b/tests/integration/targets/dcnm_template/tasks/main.yaml @@ -1,2 +1,2 @@ --- -- { include: dcnm.yaml, tags: ['dcnm','sanity'] } +- { include: dcnm.yaml, tags: ['dcnm'] } From 93dd526207f0eddf1b699d2e5ab9c0012128c6ec Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:33:16 +0530 Subject: [PATCH 188/248] Update main.yaml --- tests/integration/targets/dcnm_service_node/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_service_node/tasks/main.yaml b/tests/integration/targets/dcnm_service_node/tasks/main.yaml index 6f8dc6ee1..da3e8ee7a 100644 --- a/tests/integration/targets/dcnm_service_node/tasks/main.yaml +++ b/tests/integration/targets/dcnm_service_node/tasks/main.yaml @@ -38,4 +38,4 @@ - 'controller_version != "Unable to determine controller version"' tags: sanity -- { include: dcnm.yaml, tags: ['dcnm','sanity'] } +- { include: dcnm.yaml, tags: ['dcnm'] } From 3f95d147e9ef9fabf7b4eaf3b5499b139bc0fb6b Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:34:07 +0530 Subject: [PATCH 189/248] Rename sanity.yml to sanity.yaml --- .../dcnm_service_node/tests/dcnm/{sanity.yml => sanity.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/targets/dcnm_service_node/tests/dcnm/{sanity.yml => sanity.yaml} (100%) diff --git a/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yaml similarity index 100% rename from tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yml rename to tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yaml From 8e160312ca0aa9a6d246121689ca603eb4ec8a91 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:34:49 +0530 Subject: [PATCH 190/248] Update main.yaml --- tests/integration/targets/dcnm_resource_manager/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml b/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml index c072f092c..4eb3337a2 100644 --- a/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml @@ -1,2 +1,2 @@ --- -- { include: dcnm.yaml, tags: ['dcnm','sanity'] } +- { include: dcnm.yaml, tags: ['dcnm'] } From 426595cabf792e423f2bc4ec57bc3c0c5400b7ca Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:35:16 +0530 Subject: [PATCH 191/248] Rename sanity.yml to sanity.yaml --- .../dcnm_resource_manager/tests/dcnm/{sanity.yml => sanity.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/targets/dcnm_resource_manager/tests/dcnm/{sanity.yml => sanity.yaml} (100%) diff --git a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yaml similarity index 100% rename from tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yml rename to tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yaml From 2ceb2a146a45a32ce2e163404c1e3d8d7afca09f Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:35:49 +0530 Subject: [PATCH 192/248] Update main.yaml --- tests/integration/targets/dcnm_policy/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_policy/tasks/main.yaml b/tests/integration/targets/dcnm_policy/tasks/main.yaml index c072f092c..4eb3337a2 100644 --- a/tests/integration/targets/dcnm_policy/tasks/main.yaml +++ b/tests/integration/targets/dcnm_policy/tasks/main.yaml @@ -1,2 +1,2 @@ --- -- { include: dcnm.yaml, tags: ['dcnm','sanity'] } +- { include: dcnm.yaml, tags: ['dcnm'] } From 4248faeff1fe62a244a2e4ef3a557b3ecd0a33a0 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:36:19 +0530 Subject: [PATCH 193/248] Rename sanity.yml to sanity.yaml --- .../targets/dcnm_policy/tests/dcnm/{sanity.yml => sanity.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/targets/dcnm_policy/tests/dcnm/{sanity.yml => sanity.yaml} (100%) diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yaml similarity index 100% rename from tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yml rename to tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yaml From c2d154cec7022825857e60cf8aa7ad6f66135ba1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:36:53 +0530 Subject: [PATCH 194/248] Update main.yaml --- tests/integration/targets/dcnm_network/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_network/tasks/main.yaml b/tests/integration/targets/dcnm_network/tasks/main.yaml index 1f1b39ce0..c27294d0e 100644 --- a/tests/integration/targets/dcnm_network/tasks/main.yaml +++ b/tests/integration/targets/dcnm_network/tasks/main.yaml @@ -72,4 +72,4 @@ deploy: true tags: sanity -- { include_tasks: dcnm.yaml, tags: ['dcnm','sanity'] } +- { include_tasks: dcnm.yaml, tags: ['dcnm'] } From cb5255475d2a342f5409d9dc12a454242d868482 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:37:46 +0530 Subject: [PATCH 195/248] Rename sanity.yml to sanity.yaml --- .../targets/dcnm_network/tests/dcnm/{sanity.yml => sanity.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/targets/dcnm_network/tests/dcnm/{sanity.yml => sanity.yaml} (100%) diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml similarity index 100% rename from tests/integration/targets/dcnm_network/tests/dcnm/sanity.yml rename to tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml From 6bd077aa268e92f2835311128031e7e6a4cfcb54 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:38:37 +0530 Subject: [PATCH 196/248] Rename sanity.yml to sanity.yaml --- .../targets/dcnm_links/tests/dcnm/{sanity.yml => sanity.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/targets/dcnm_links/tests/dcnm/{sanity.yml => sanity.yaml} (100%) diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yaml similarity index 100% rename from tests/integration/targets/dcnm_links/tests/dcnm/sanity.yml rename to tests/integration/targets/dcnm_links/tests/dcnm/sanity.yaml From a84c5616e74ff65c1b904bb44be350854c701a87 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 18:59:34 +0530 Subject: [PATCH 197/248] Updated config.yml --- .circleci/config.yml | 66 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d2e41de76..2fea9d8f0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,12 +34,12 @@ parameters: run-service_node: type: boolean default: false - run-service_policy: - type: boolean - default: false - run-service_route_peering: - type: boolean - default: false +# run-service_policy: +# type: boolean +# default: false +# run-service_route_peering: +# type: boolean +# default: false run-template: type: boolean default: false @@ -300,8 +300,8 @@ workflows: plugins/modules/dcnm_resource_manager.py run-resource_manager true plugins/modules/dcnm_rest.py run-rest true plugins/modules/dcnm_service_node.py run-service_node true - plugins/modules/dcnm_service_policy.py run-service_policy true - plugins/modules/dcnm_service_route_peering.py run-service_route_peering true + # plugins/modules/dcnm_service_policy.py run-service_policy true + # plugins/modules/dcnm_service_route_peering.py run-service_route_peering true plugins/modules/dcnm_template.py run-template true plugins/modules/dcnm_vrf.py run-vrf true @@ -322,8 +322,8 @@ workflows: tests/integration/targets/prepare_dcnm_intf/tasks/.* run-all true tests/integration/targets/prepare_dcnm_links/tasks/.* run-links true tests/integration/targets/prepare_dcnm_policy/tasks/.* run-policy true - tests/integration/targets/prepare_dcnm_service_policy/tasks/.* run-service_policy true - tests/integration/targets/prepare_dcnm_service_route_peering/tasks/.* run-service_route_peering true + # tests/integration/targets/prepare_dcnm_service_policy/tasks/.* run-service_policy true + # tests/integration/targets/prepare_dcnm_service_route_peering/tasks/.* run-service_route_peering true tests/integration/targets/prepare_dcnm_template/tasks/.* run-template true @@ -451,33 +451,33 @@ workflows: - service_node - service_policy: - when: - or: - - << pipeline.parameters.run-all >> - - << pipeline.parameters.run-service_policy >> - jobs: - - addrole: +# service_policy: +# when: +# or: +# - << pipeline.parameters.run-all >> +# - << pipeline.parameters.run-service_policy >> +# jobs: +# - addrole: - matrix: - parameters: - modulename: - - service_policy +# matrix: +# parameters: +# modulename: +# - service_policy - service_route_peering: - when: - or: - - << pipeline.parameters.run-all >> - - << pipeline.parameters.run-service_route_peering >> - jobs: - - addrole: - - matrix: - parameters: - modulename: - - service_route_peering +# service_route_peering: +# when: +# or: +# - << pipeline.parameters.run-all >> +# - << pipeline.parameters.run-service_route_peering >> +# jobs: +# - addrole: +# +# matrix: +# parameters: +# modulename: +# - service_route_peering template: when: From c918844c277d251dda86a2580645818ced5688ad Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 19:04:16 +0530 Subject: [PATCH 198/248] Updated config.yml --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2fea9d8f0..db9b4182e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -300,8 +300,8 @@ workflows: plugins/modules/dcnm_resource_manager.py run-resource_manager true plugins/modules/dcnm_rest.py run-rest true plugins/modules/dcnm_service_node.py run-service_node true - # plugins/modules/dcnm_service_policy.py run-service_policy true - # plugins/modules/dcnm_service_route_peering.py run-service_route_peering true + # plugins/modules/dcnm_service_policy.py run-service_policy true + # plugins/modules/dcnm_service_route_peering.py run-service_route_peering true plugins/modules/dcnm_template.py run-template true plugins/modules/dcnm_vrf.py run-vrf true @@ -322,8 +322,8 @@ workflows: tests/integration/targets/prepare_dcnm_intf/tasks/.* run-all true tests/integration/targets/prepare_dcnm_links/tasks/.* run-links true tests/integration/targets/prepare_dcnm_policy/tasks/.* run-policy true - # tests/integration/targets/prepare_dcnm_service_policy/tasks/.* run-service_policy true - # tests/integration/targets/prepare_dcnm_service_route_peering/tasks/.* run-service_route_peering true + # tests/integration/targets/prepare_dcnm_service_policy/tasks/.* run-service_policy true + # tests/integration/targets/prepare_dcnm_service_route_peering/tasks/.* run-service_route_peering true tests/integration/targets/prepare_dcnm_template/tasks/.* run-template true From 380c4fd81c353077eeb4f766933aba2fe2e998d2 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 19:07:33 +0530 Subject: [PATCH 199/248] Updated config.yml --- .circleci/config.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index db9b4182e..a90590120 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,12 +34,12 @@ parameters: run-service_node: type: boolean default: false -# run-service_policy: -# type: boolean -# default: false -# run-service_route_peering: -# type: boolean -# default: false + run-service_policy: + type: boolean + default: false + run-service_route_peering: + type: boolean + default: false run-template: type: boolean default: false @@ -300,8 +300,8 @@ workflows: plugins/modules/dcnm_resource_manager.py run-resource_manager true plugins/modules/dcnm_rest.py run-rest true plugins/modules/dcnm_service_node.py run-service_node true - # plugins/modules/dcnm_service_policy.py run-service_policy true - # plugins/modules/dcnm_service_route_peering.py run-service_route_peering true + plugins/modules/dcnm_service_policy.py run-service_policy true + plugins/modules/dcnm_service_route_peering.py run-service_route_peering true plugins/modules/dcnm_template.py run-template true plugins/modules/dcnm_vrf.py run-vrf true @@ -322,13 +322,13 @@ workflows: tests/integration/targets/prepare_dcnm_intf/tasks/.* run-all true tests/integration/targets/prepare_dcnm_links/tasks/.* run-links true tests/integration/targets/prepare_dcnm_policy/tasks/.* run-policy true - # tests/integration/targets/prepare_dcnm_service_policy/tasks/.* run-service_policy true - # tests/integration/targets/prepare_dcnm_service_route_peering/tasks/.* run-service_route_peering true + tests/integration/targets/prepare_dcnm_service_policy/tasks/.* run-service_policy true + tests/integration/targets/prepare_dcnm_service_route_peering/tasks/.* run-service_route_peering true tests/integration/targets/prepare_dcnm_template/tasks/.* run-template true - # module-a/.* run-module-a true - # module-b/.* run-module-b true + # module-a/.* run-module-a true + # module-b/.* run-module-b true all-unit: when: From 15e7901df386cfc0235b8db04d7feca8e431d980 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 13 Jul 2023 20:06:00 +0530 Subject: [PATCH 200/248] Update sanity.yaml --- tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml index 9a099bbb8..54f7e64fd 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml @@ -278,7 +278,7 @@ ############################################## - name: Create ethernet interfaces - cisco.dcnm.dcnm_interface: ð_merge + cisco.dcnm.dcnm_interface: ð_merge2 check_deploy: True fabric: "{{ ansible_it_fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] From 24b2cc6567d9c950d0304791a0388f4a5c6e768f Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 14 Jul 2023 13:52:49 +0530 Subject: [PATCH 201/248] Update sanity.yaml --- .../integration/targets/dcnm_interface/tests/dcnm/sanity.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml index 54f7e64fd..c86b16244 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml @@ -383,7 +383,7 @@ ############################################## - name: Replace ethernet interfaces - cisco.dcnm.dcnm_interface: ð_replace + cisco.dcnm.dcnm_interface: ð_replace2 check_deploy: True fabric: "{{ ansible_it_fabric }}" state: replaced # only choose form [merged, replaced, deleted, overridden, query] @@ -476,7 +476,7 @@ loop: '{{ result.response }}' - name: Replace ethernet interfaces - Idempotence - cisco.dcnm.dcnm_interface: *eth_replace + cisco.dcnm.dcnm_interface: *eth_replace2 register: result - assert: From 9a60c67716b114d88cdd33b5d442dbaa077a41ad Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 14 Jul 2023 14:20:54 +0530 Subject: [PATCH 202/248] Update sanity.yaml --- .../targets/dcnm_template/tests/dcnm/sanity.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml index 5fb352aa9..266599ead 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml @@ -230,14 +230,14 @@ ## CLEANUP ## ############################################## -- name: Initialize the setup - 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 + - name: Initialize the setup + 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 ############################################## ## NO DELETE ## From 54bd4bd4c101af7b6efcf272af16695035b18632 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 14 Jul 2023 15:02:14 +0530 Subject: [PATCH 203/248] Update sanity.yaml --- .../targets/dcnm_template/tests/dcnm/sanity.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml index 266599ead..2b4d8fe4e 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml @@ -111,6 +111,10 @@ - '"Template Created" in item["DATA"]["status"]' loop: '{{ result.response }}' + - name: Cleanup - sleep for 100 seconds for DCNM to completely update the state + wait_for: + timeout: 100 + - name: Create templates again - Idempotence cisco.dcnm.dcnm_template: *temp_merge register: result @@ -347,7 +351,7 @@ ############################################## - name: Create templates - cisco.dcnm.dcnm_template: &temp_merge + cisco.dcnm.dcnm_template: &temp_merge3 state: merged # only choose form [merged, deleted, query] config: - name: test_fail @@ -393,7 +397,7 @@ - name: Create templates - cisco.dcnm.dcnm_template: &temp_merge + cisco.dcnm.dcnm_template: &temp_merge4x` state: replaced # only choose form [merged, deleted, query] config: - name: template_101 From 5c854d67bf1d09c0a43ee9fa82aae2ae5875b806 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 14 Jul 2023 18:20:54 +0530 Subject: [PATCH 204/248] Updated config.yml --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a90590120..44fcc804b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -201,6 +201,8 @@ jobs: name: Run sanity tests py << parameters.py_version >> command: | export ANSIBLE_ROLES_PATH=/home/circleci/repo/tests/integration/targets/ + export ANSIBLE_PERSISTENT_CONNECT_TIMEOUT=1000 + export ANSIBLE_PERSISTENT_COMMAND_TIMEOUT=1000 env ansible-playbook -i hosts dcnm_roles.yaml --tags sanity -vvvv # command: ansible-test sanity --python 3.8 -v --color --truncate 0 From ec5f07b5a45d9cd620ceadbb7b16ecbf0a43dcfe Mon Sep 17 00:00:00 2001 From: Pari-Dhanani Date: Tue, 18 Jul 2023 20:31:37 -0700 Subject: [PATCH 205/248] Updated sanity --- dcnm-ut | 0 dcnm_roles.yaml | 21 + dcnm_test.yaml | 15 + group_vars/dcnm.yaml | 140 ++++ hosts | 5 + .../dcnm_interface/tests/dcnm/sanity.yaml | 205 +---- .../dcnm_inventory/tests/dcnm/sanity.yaml | 40 +- .../targets/dcnm_links/tests/dcnm/sanity.yaml | 225 +++--- .../dcnm_policy/tests/dcnm/sanity.yaml | 89 ++- .../dcnm_service_node/tests/dcnm/sanity.yaml | 367 +++++++-- .../tasks/dcnm.yaml | 11 + .../tests/dcnm/sanity.yaml | 332 ++++++++ .../dcnm_template/tests/dcnm/sanity.yaml | 44 +- .../targets/dcnm_vrf/tests/dcnm/sanity.yaml | 26 + .../prepare_dcnm_policy/tasks/main.yaml | 12 +- .../tasks/main.yaml | 12 +- .../prepare_dcnm_template/tasks/main.yaml | 20 +- .../modules/dcnm/test_dcnm_network.py.save | 741 ++++++++++++++++++ 18 files changed, 1862 insertions(+), 443 deletions(-) create mode 100644 dcnm-ut create mode 100644 dcnm_roles.yaml create mode 100644 dcnm_test.yaml create mode 100644 group_vars/dcnm.yaml create mode 100644 hosts create mode 100644 tests/integration/targets/dcnm_service_route_peering/tests/dcnm/sanity.yaml create mode 100644 tests/unit/modules/dcnm/test_dcnm_network.py.save diff --git a/dcnm-ut b/dcnm-ut new file mode 100644 index 000000000..e69de29bb diff --git a/dcnm_roles.yaml b/dcnm_roles.yaml new file mode 100644 index 000000000..143196b22 --- /dev/null +++ b/dcnm_roles.yaml @@ -0,0 +1,21 @@ +--- +- hosts: dcnm + gather_facts: no + connection: ansible.netcommon.httpapi + + tasks: + + vars: + debug: false + + roles: + #- dcnm_interface + #- dcnm_template + #- dcnm_resource_manager + #- dcnm_policy + #- dcnm_inventory + #- dcnm_vrf + #- dcnm_service_node + #- dcnm_network + #- dcnm_links + - dcnm_service_route_peering diff --git a/dcnm_test.yaml b/dcnm_test.yaml new file mode 100644 index 000000000..d63a14142 --- /dev/null +++ b/dcnm_test.yaml @@ -0,0 +1,15 @@ +--- +- hosts: dcnm + gather_facts: no + connection: ansible.netcommon.httpapi + + tasks: + + - set_fact: + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" + + - name: MERGED - Verify if fabric is deployed. + cisco.dcnm.dcnm_rest: + method: GET + path: "{{ rest_path }}" + register: result diff --git a/group_vars/dcnm.yaml b/group_vars/dcnm.yaml new file mode 100644 index 000000000..26c9a0dc3 --- /dev/null +++ b/group_vars/dcnm.yaml @@ -0,0 +1,140 @@ +--- + +ansible_ssh_user: admin +ansible_user: admin +ansible_network_os: cisco.dcnm.dcnm +ansible_ssh_pass: ins3965! +ansible_pass: ins3965! +ansible_python_interpreter: python +ansible_httpapi_validate_certs: False +ansible_httpapi_use_ssl : True +ansible_int1 : Ethernet1/3 +ansible_int2 : Ethernet1/2 +ansible_int3 : Ethernet1/2 +intf_1_10 : Ethernet1/10 +intf_1_3 : Ethernet1/3 +intf_1_2 : Ethernet1/2 +intf_1_1 : Ethernet1/1 +intf_1_4 : Ethernet1/4 +intf_1_5 : Ethernet1/5 +ansible_sw1_int1 : Ethernet1/24 +ansible_sw1_int2 : Ethernet1/26 +ansible_sw2_int1 : Ethernet1/24 +ansible_sw2_int2 : Ethernet1/26 +ansible_sw1_int3 : Ethernet1/24 +ansible_sw1_int4 : Ethernet1/25 +ansible_sw2_int3 : Ethernet1/24 +ansible_sw2_int4 : Ethernet1/26 +ansible_sw2_int5 : Ethernet1/24 +ansible_sw2_int6 : Ethernet1/26 +ansible_it_fabric : test_fabric +ansible_ext_fabric : test_ext_fabric +ansible_it_service_fabric : test_ext_fabric +ansible_svi_fabric : test_fabric +test_fabric: test_fabric +ansible_num_fabric: test_fabric +ansible_switch1 : 10.2.5.10 +ansible_switch2 : 10.2.5.11 +ansible_sno_1 : 9QCOXEMR23F +ansible_sno_2 : 94ISY0RAPF9 +ansible_num_switch1 : 10.2.5.10 +ansible_num_switch2 : 10.2.5.11 +switch_username: admin +switch_password: ins3965! +ansible_vpc1: vPC2 +ansible_vpc2: vPC1 +ansible_poap_switch : 192.168.123.223 +ansible_poap_serial : "9D2DAUJJFQQ" +ansible_poap_model : "N9K-C9300v" +ansible_poap_swversion : "9.3(7)" +ansible_poap_hostname : "test_poap_test" +ansible_poap_config_data : '{"modulesModel": ["N9K-C9300v"], "gateway": "192.168.123.1/24"}' +ansible_prepro_switch : 192.168.123.224 +ansible_prepro_serial : "9D2DAUJJFRR" +ansible_prepro_model : "N9K-C9300v" +ansible_prepro_swversion : "9.3(7)" +ansible_prepro_hostname : "test_poap_prepro" +ansible_modules_model: ["N9K-C9300v"] +ansible_bstrap_gateway: 192.168.123.1/24 +ansible_prepro_config_data : '{modulesModel: ["N9K-C9300v"], gateway: 192.168.123.1/24}' +ansible_rma_serial: "9D2DAUJJFQQ" +ansible_switch1_serial: "944XJW7L3YJ" +ansible_rma_model : "N9K-C9300v" +ansible_rma_swversion : "9.3(7)" +ansible_rma_hostname : "test_poap_test" +ansible_rma_modules: ["N9K-C9300v"] +test_ing_fabric: test_poap +ansible_ing_switch1: 192.168.123.219 +ansible_ing_sw1_int1 : Ethernet1/24 +ansible_ing_sw1_int2 : Ethernet1/26 + +# All physical interfaces are defined as variables here. Make sure for running VPC interfaces +# the following interfaces are not part of VPC link +ansible_eth_intf1: eth1/16 +ansible_sub_intf1: eth1/16.10 +ansible_eth_intf2: eth1/20 +ansible_eth_intf3: eth1/21 +ansible_eth_intf4: eth1/22 +ansible_eth_intf5: eth1/23 +ansible_eth_intf6: eth1/24 +ansible_eth_intf7: eth1/30 +ansible_eth_intf8: eth1/31 +ansible_eth_intf9: eth1/32 +ansible_eth_intf10: eth1/33 +ansible_eth_intf11: eth1/34 +ansible_eth_intf12: eth1/40 +ansible_sub_intf4: eth1/19.10 +ansible_sub_intf5: eth1/19.20 +ansible_sub_intf2: eth1/16.20 +ansible_sub_intf3: eth1/16.30 +ansible_eth_intf13: eth1/10 +ansible_eth_intf14: eth1/11 +ansible_eth_intf15: eth1/12 +ansible_eth_intf16: eth1/13 +ansible_eth_intf17: eth1/14 +ansible_eth_intf18: eth1/15 +# Changed this last - eth1/15 to eth1/18 +ansible_eth_intf19: eth1/18 +ansible_eth_intf20: eth1/17 +ansible_eth_intf21: eth1/25 +ansible_eth_intf22: eth1/26 +ansible_eth_intf23: eth1/28 +ansible_eth_intf24: eth1/27 + +# VRFs for Service Route Peering + +ansible_vrf_11 : MY_IT_VRF_11 +ansible_vrf_12 : MY_IT_VRF_12 +ansible_vrf_21 : MY_IT_VRF_21 +ansible_vrf_22 : MY_IT_VRF_22 +ansible_vrf_31 : MY_IT_VRF_31 +ansible_vrf_32 : MY_IT_VRF_32 +ansible_vrf_41 : MY_IT_VRF_41 +ansible_vrf_42 : MY_IT_VRF_42 +ansible_vrf_51 : MY_IT_VRF_51 +ansible_vrf_52 : MY_IT_VRF_52 +ansible_vrf_61 : MY_IT_VRF_61 +ansible_vrf_62 : MY_IT_VRF_62 +ansible_vrf_71 : MY_IT_VRF_71 +ansible_vrf_72 : MY_IT_VRF_72 +ansible_vrf_81 : MY_IT_VRF_81 +ansible_vrf_82 : MY_IT_VRF_82 + +# Service Nodes for Service Route Peering + +ansible_snode_1 : IT-SN-1 +ansible_snode_2 : IT-SN-2 +ansible_snode_3 : IT-SN-3 + +ansible_fw_rp1: IT-FW-RP1 +ansible_fw_rp2: IT-FW-RP2 +ansible_fw_rp3: IT-FW-RP3 +ansible_adc_rp4: IT-ADC-RP4 +ansible_adc_rp5: IT-ADC-RP5 +ansible_adc_rp6: IT-ADC-RP6 +ansible_adc_rp7: IT-ADC-RP7 +ansible_adc_rp8: IT-VNF-RP8 + +ansible_att_intf1 : Ethernet1/2 +ansible_att_intf2 : Ethernet1/3 +ansible_att_intf3 : Ethernet1/4 diff --git a/hosts b/hosts new file mode 100644 index 000000000..8535ecdb2 --- /dev/null +++ b/hosts @@ -0,0 +1,5 @@ +[all:vars] +ansible_python_interpreter=/home/circleci/.pyenv/versions/python_3.9/bin/python + +[dcnm] + 10.2.1.99 diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml index 9a099bbb8..22ef25a6f 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml @@ -22,7 +22,7 @@ loop: '{{ result.response }}' tags: sanity -- name: Sanity tests +- name: Sanity tests - 1 tags: sanity block: @@ -30,7 +30,7 @@ ## MERGE ## ############################################## - - name: Create ethernet interfaces + - name: Create ethernet interfaces - 1 cisco.dcnm.dcnm_interface: ð_merge check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -135,7 +135,7 @@ ## REPLACE ## ############################################## - - name: Replace ethernet interfaces + - name: Replace ethernet interfaces - 1 cisco.dcnm.dcnm_interface: ð_replace check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -228,7 +228,7 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - name: Replace ethernet interfaces - Idempotence + - name: Replace ethernet interfaces - 1 - Idempotence cisco.dcnm.dcnm_interface: *eth_replace register: result @@ -266,19 +266,16 @@ loop: '{{ result.response }}' when: IT_CONTEXT is not defined - - - - -## LO - +- name: Sanity tests - 2 + tags: sanity + block: ############################################## ## MERGE ## ############################################## - - name: Create ethernet interfaces - cisco.dcnm.dcnm_interface: ð_merge + - name: Create ethernet interfaces - 2 + cisco.dcnm.dcnm_interface: ð_merge2 check_deploy: True fabric: "{{ ansible_it_fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] @@ -382,8 +379,8 @@ ## REPLACE ## ############################################## - - name: Replace ethernet interfaces - cisco.dcnm.dcnm_interface: ð_replace + - name: Replace ethernet interfaces - 2 + cisco.dcnm.dcnm_interface: ð_replace2 check_deploy: True fabric: "{{ ansible_it_fabric }}" state: replaced # only choose form [merged, replaced, deleted, overridden, query] @@ -475,8 +472,8 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - name: Replace ethernet interfaces - Idempotence - cisco.dcnm.dcnm_interface: *eth_replace + - name: Replace ethernet interfaces - 2 - Idempotence + cisco.dcnm.dcnm_interface: *eth_replace2 register: result - assert: @@ -513,11 +510,10 @@ loop: '{{ result.response }}' when: IT_CONTEXT is not defined +- name: Sanity tests - 3 + tags: sanity + block: - -## pc - - ############################################## ## MERGE ## ############################################## @@ -730,9 +726,9 @@ loop: '{{ result.response }}' when: IT_CONTEXT is not defined - -## sub - +- name: Sanity tests - 4 + tags: sanity + block: ############################################## ## MERGE ## @@ -898,166 +894,9 @@ loop: '{{ result.response }}' when: IT_CONTEXT is not defined - -## svi - - -############################################## -## MERGE ## -############################################## - - - name: Create SVI interfaces including optional parameters - cisco.dcnm.dcnm_interface: - check_deploy: True - fabric: "{{ ansible_svi_fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] - config: - - name: vlan1001 # should be of the form vlan - type: svi # choose from this list [pc, vpc, sub_int, lo, eth, svi] - switch: - - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed - deploy: true # choose from [true, false] - profile: - int_vrf: blue # optional, Interface VRF name, default is "default" - ipv4_addr: 192.168.2.1 # optional, Interfae IP, default is "" - ipv4_mask_len: 24 # optional, IP mask length, default is "" - mtu: 9216 # optional, MTU default is "" - route_tag: 1001 # optional, Routing TAG, default is "" - disable_ip_redirects: true # optional, flag to enable/disable IP redirects, default is "false" - cmds: # Freeform config - - no shutdown - admin_state: true # Flag to enable/disable Vlan interaface - enable_hsrp: true # optional, flag to enable/disable HSRP on the interface, default is "false" - hsrp_vip: 192.168.2.100 # optional, Virtual IP address for HSRP, default is "" - hsrp_group: 10 # optional, HSRP group, default is "" - hsrp_priority: 5 # optional, HSRP priority, default is "" - hsrp_vmac: 0000.0101.ac0a # optional, HSRP virtual MAC, default is "" - dhcp_server_addr1: 192.200.1.1 # optional, DHCP relay server address, default is "" - vrf_dhcp1: blue # optional, VRF to reach DHCP server. default is "" - dhcp_server_addr2: 192.200.1.2 # optional, DHCP relay server address, default is "" - vrf_dhcp2: blue # optional, VRF to reach DHCP server. default is "" - dhcp_server_addr3: 192.200.1.3 # optional, DHCP relay server address, default is "" - vrf_dhcp3: blue # optional, VRF to reach DHCP server. default is "" - adv_subnet_in_underlay: true # optional, flag to enable/disable advertisements of subnets into underlay, default is "false" - enable_netflow: false # optional, flag to enable netflow, default is "false" - netflow_monitor: svi1001 # optional, name of netflow monitor, default is "" - hsrp_version: 1 # optional, HSRP protocol version, default is 1 - preempt: true # optional, flag to enable/disable overthrow of low priority active routers, optional is "false" - mode: vlan # choose from [vlan, vlan_admin_state], default is "vlan" - description: Switched vlan interface 1001 # optional, Interface description, default is "" - register: result - - - 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: - that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - -############################################## -## REPLACE ## -############################################## - - - name: Replace SVI interface - cisco.dcnm.dcnm_interface: &svi_replace - check_deploy: True - fabric: "{{ ansible_svi_fabric }}" - state: replaced # only choose form [merged, replaced, deleted, overridden, query] - config: - - name: vlan1001 # should be of the form vlan - type: svi # choose from this list [pc, vpc, sub_int, lo, eth, svi] - switch: - - "{{ ansible_switch1 }}" # provide the switch information where the config is to be deployed - deploy: true # choose from [true, false] - profile: - int_vrf: red # optional, Interface VRF name, default is "default" - ipv4_addr: 192.169.2.1 # optional, Interfae IP, default is "" - ipv4_mask_len: 20 # optional, IP mask length, default is "" - mtu: 9210 # optional, MTU default is "" - route_tag: 1002 # optional, Routing TAG, default is "" - disable_ip_redirects: false # optional, flag to enable/disable IP redirects, default is "false" - cmds: # Freeform config - - no shutdown - admin_state: false # Flag to enable/disable Vlan interaface - enable_hsrp: true # optional, flag to enable/disable HSRP on the interface, default is "false" - hsrp_vip: 192.169.2.100 # optional, Virtual IP address for HSRP, default is "" - hsrp_group: 11 # optional, HSRP group, default is "" - hsrp_priority: 5 # optional, HSRP priority, default is "" - hsrp_vmac: 0000.0102.ac0a # optional, HSRP virtual MAC, default is "" - dhcp_server_addr1: 193.200.1.1 # optional, DHCP relay server address, default is "" - vrf_dhcp1: green # optional, VRF to reach DHCP server. default is "" - dhcp_server_addr2: 193.200.1.2 # optional, DHCP relay server address, default is "" - vrf_dhcp2: green # optional, VRF to reach DHCP server. default is "" - dhcp_server_addr3: 193.200.1.3 # optional, DHCP relay server address, default is "" - vrf_dhcp3: green # optional, VRF to reach DHCP server. default is "" - adv_subnet_in_underlay: false # optional, flag to enable/disable advertisements of subnets into underlay, default is "false" - enable_netflow: false # optional, flag to enable netflow, default is "false" - netflow_monitor: svi1002 # optional, name of netflow monitor, default is "" - hsrp_version: 2 # optional, HSRP protocol version, default is 1 - preempt: false # optional, flag to enable/disable overthrow of low priority active routers, optional is "false" - mode: vlan # choose from [vlan, vlan_admin_state], default is "vlan" - description: Switched vlan interface 1001 - Rep # optional, Interface description, default is "" - register: result - - - 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) == 1' - - - assert: - that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - - - name: Replace SVI interfaces - Idempotence - cisco.dcnm.dcnm_interface: *svi_replace - register: result - - - 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: - that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - -############################################## -## CLEANUP ## -############################################## - - always: - - - name: Put fabric to default state - cisco.dcnm.dcnm_interface: - check_deploy: True - fabric: "{{ ansible_svi_fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined - - - assert: - that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined - +- name: Sanity tests - 5 + tags: sanity + block: ############################################## ## MERGE ## diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml index c8e680b31..8f58502df 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml @@ -24,6 +24,12 @@ - 'result.response.DATA != None' tags: sanity +- name: DELETED - setup - Clean up existing devices + cisco.dcnm.dcnm_inventory: + fabric: "{{ ansible_it_fabric }}" + state: deleted + register: result + tags: sanity ############################################## ## MERGED ## @@ -34,7 +40,7 @@ fabric: "{{ ansible_it_fabric }}" state: merged config: - - seed_ip: "{{ ansible_switch3 }}" + - seed_ip: "{{ ansible_switch1 }}" auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] user_name: "{{ switch_username }}" password: "{{ switch_password }}" @@ -76,7 +82,7 @@ fabric: "{{ ansible_it_fabric }}" state: query config: - - seed_ip: "{{ ansible_switch3 }}" + - seed_ip: "{{ ansible_switch1 }}" role: leaf # default is Leaf - choose from [Leaf, Spine, Border, Border Spine, Border Gateway, Border Gateway Spine # Super Spine, Border Super Spine, Border Gateway Super Spine] register: result @@ -99,7 +105,7 @@ fabric: "{{ ansible_it_fabric }}" state: overridden config: - - seed_ip: "{{ ansible_switch4 }}" + - seed_ip: "{{ ansible_switch2 }}" auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] user_name: "{{ switch_username }}" password: "{{ switch_password }}" @@ -134,12 +140,12 @@ ## CLEAN-UP ## ############################################## -- name: DELETED - setup - Clean up any existing devices +- name: DELETED - setup - Clean up existing devices cisco.dcnm.dcnm_inventory: &clean fabric: "{{ ansible_it_fabric }}" state: deleted config: - - seed_ip: "{{ ansible_switch4 }}" + - seed_ip: "{{ ansible_switch2 }}" auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] user_name: "{{ switch_username }}" password: "{{ switch_password }}" @@ -152,3 +158,27 @@ cisco.dcnm.dcnm_inventory: *clean register: result tags: sanity + +############################################## +## RESET FABRIC ## +############################################## + +- name: RESET - setup switches in fabric + cisco.dcnm.dcnm_inventory: + fabric: "{{ ansible_it_fabric }}" + config: + - seed_ip: "{{ ansible_switch1 }}" + 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 + preserve_config: False # boolean, default is true + - seed_ip: "{{ ansible_switch2 }}" + 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 + preserve_config: False # boolean, default is true + register: result + tags: sanity + diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yaml index b78f24de6..16bfcb847 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yaml @@ -15,37 +15,37 @@ - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] - src_fabric: "{{ ansible_ipv6_fabric }}" + src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric + - 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_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric + src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric + dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric + - 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_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric + src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric + dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric + - 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 - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric + src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric + dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric + - dst_fabric: "{{ ansible_num_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_ipv6_switch2 }}" # Device on the Destination fabric + src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric + dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric + - dst_fabric: "{{ ansible_num_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_ipv6_switch2 }}" # Device 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 @@ -58,26 +58,24 @@ ## MERGE ## ############################################## - - name: Create Links including all optional parameters - cisco.dcnm.dcnm_links: &links_merge_with_opt + - name: Create Links + cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] - src_fabric: "{{ ansible_ipv6_fabric }}" + src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric + - 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_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 + 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 ] profile: - peer1_ipv4_addr: 192.169.1.1 # optional, default is "" - peer2_ipv4_addr: 192.169.1.2 # optional, default is "" - peer1_ipv6_addr: 2080:0201::01 # IP address of the Source interface - peer2_ipv6_addr: 2080:0201::02 # IP address of the Source interface + 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 "" @@ -90,158 +88,139 @@ peer2_cmds: # Freeform config for destination device - no shutdown # optional, default is "" - - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric + - 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_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 + 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 ] - - 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 ] - - 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: 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: 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 "" - register: result - assert: that: - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 3' + - '(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_ipv6_fabric }}" ] | length) == 2' + - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### QUERY ## -############################################### +############################################## +## MODIFY ## +############################################## + + - name: Merge modified info into existing 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: "{{ 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: 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 + admin_state: false # choose from [true, false] + mtu: 1000 # + peer1_description: "MOD - Description of source - 1" # optional, default is "" + peer2_description: "MOD - Description of dest - 1" # optional, default is "" + peer1_bfd_echo_disable: true # optional, choose from [true, false] + peer2_bfd_echo_disable: true # optional, choose from [true, false] + enable_macsec: false # optional, choose from [true, false] + peer1_cmds: # Freeform config for source device + - cdp enable # optional, default is "" + peer2_cmds: # Freeform config for destination device + - cdp enable # optional, default is "" - - name: Query Links - with Src Fabric - cisco.dcnm.dcnm_links: - state: query # choose from [merged, replaced, deleted, query] - src_fabric: "{{ ansible_ipv6_fabric }}" + - 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 ] register: result - assert: that: - '(result["response"] | length) >= 3' - - - name: Query Links - with Src & Dst Fabric - 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 + - '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_num_fabric }}" ] | length) == 2' - assert: that: - '(result["response"] | length) >= 3' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' ############################################## ## REPLACE ## ############################################## - - name: Replace Links + - name: Replace Links cisco.dcnm.dcnm_links: &links_replace state: replaced # choose from [merged, replaced, deleted, query] - src_fabric: "{{ ansible_ipv6_fabric }}" + src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric + - 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_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 + 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 ] profile: - peer1_ipv4_addr: 193.169.1.1 # optional, default is "" - peer2_ipv4_addr: 193.169.1.2 # optional, default is "" - peer1_ipv6_addr: 2089:0201::01 # IP address of the Source interface - peer2_ipv6_addr: 2089:0201::02 # IP address of the Source interface - admin_state: true # choose from [true, false] - mtu: 3216 # + 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 + admin_state: false # choose from [true, false] + mtu: 1000 # + peer1_description: "" # optional, default is "" + peer2_description: "" # optional, default is "" + peer1_bfd_echo_disable: true # optional, choose from [true, false] + peer2_bfd_echo_disable: true # optional, choose from [true, false] enable_macsec: false # optional, choose from [true, false] - peer1_cmds: # Freeform config for source device - - cdp enable # optional, default is "" - peer2_cmds: # Freeform config for destination device - - cdp enable # optional, default is "" - - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric + - 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_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 + 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 ] - - 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 ] - - profile: - peer1_ipv4_addr: 193.169.2.1 # optional, default is "" - peer2_ipv4_addr: 193.169.2.2 # optional, default is "" - peer1_ipv6_addr: 2089:0202::01 # IP address of the Source interface - peer2_ipv6_addr: 2089:0202::02 # IP address of the Source interface - admin_state: true # choose from [true, false] - mtu: 2000 # - 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] - register: result - assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 2' + - '(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) == 2' + - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - assert: that: @@ -263,7 +242,7 @@ - '(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) == 2' + - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - assert: that: diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yaml index 196e639e4..f1c56dc31 100644 --- a/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yaml @@ -77,7 +77,7 @@ - assert: that: - 'item["RETURN_CODE"] == 200' - - '"is created successfully" in item["DATA"]["successList"][0]["message"]' + - '"Success" in item["DATA"]["successList"][0]["status"]' when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: @@ -95,7 +95,7 @@ - name: Setting fact set_fact: - query_policy_list: "{{ (query_policy_list | default([])) + [item['DATA']['successList'][0]['message'].split(' ')[0]] }}" + 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: @@ -103,11 +103,11 @@ - name: Show the policy_list information debug: - var: query_policy_list + var: modify_policy_list - name: Setting fact set_fact: - list_len: "{{ query_policy_list | length }}" + list_len: "{{ modify_policy_list | length }}" ############################################## ## QUERY ## @@ -130,26 +130,33 @@ - '(result["diff"][0]["deploy"] | length) == 0' - '(result["response"] | length) != 0' + - name: Query specific policies + cisco.dcnm.dcnm_policy: + fabric: "{{ ansible_it_fabric }}" + state: query + config: + - name: template_101 + - name: template_102 + - name: template_103 + - name: template_104 + - name: template_105 + - switch: + - 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' + ############################################## ## MODIFY ## ############################################## - - name: Setting fact - 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 - - - name: Show the policy_list information - debug: - var: modify_policy_list - - - name: Setting fact - set_fact: - list_len: "{{ modify_policy_list | length }}" - - name: Modify existing policy using template name - should create the policy cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" @@ -172,6 +179,48 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' + - name: Modify policies - using policy IDs + cisco.dcnm.dcnm_policy: + fabric: "{{ ansible_it_fabric }}" + state: merged + config: + - name: "{{ item }}" # Pick the policy Ids from the facts + description: Modified the policy "{{ item }}" using policy ID + priority: "{{ 100 + my_idx }}" + - switch: + - ip: "{{ ansible_switch1 }}" + loop: '{{ modify_policy_list }}' + loop_control: + index_var: my_idx + register: result + + # Assert for description being non-empty + - 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 + + # Assert for Create responses + - 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 + + # Assert for deploy responses + - 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 ############################################## ## CLEANUP ## 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 b241e09ee..5256dbf9a 100644 --- a/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yaml @@ -59,7 +59,11 @@ delay: 5 tags: sanity -- name: REPLACED - Create Service Node with 2 switches and vPC Interface with type firewall +############################################### +### REPLACED ## +############################################### + +- name: REPLACED - Create Service Node with single switch cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -69,10 +73,9 @@ type: firewall form_factor: virtual svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" + attach_interface: "{{ ansible_int1 }}" switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - "{{ ansible_switch1 }}" register: result tags: sanity @@ -81,26 +84,22 @@ - '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.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 + tags: sanity - name: REPLACED - sleep for 20 seconds for DCNM to completely update the state wait_for: timeout: 20 - tags: sanity - -############################################### -### REPLACED ## -############################################### + tags: sanity - name: REPLACED - Replace Service Node with form factor physical - cisco.dcnm.dcnm_service_node: &conf1 + cisco.dcnm.dcnm_service_node: &conf2 fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" state: replaced @@ -109,10 +108,9 @@ type: firewall form_factor: physical svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" + attach_interface: "{{ ansible_int1 }}" switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - "{{ ansible_switch1 }}" register: result tags: sanity @@ -121,45 +119,137 @@ - '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.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"' - tags: sanity -- name: REPLACED - sleep for 40 seconds for DCNM to completely update the state +- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state wait_for: - timeout: 40 + timeout: 20 tags: sanity -- name: REPLACED - conf1 - Idempotence - cisco.dcnm.dcnm_service_node: *conf1 +- name: REPLACED - conf2 - Idempotence + cisco.dcnm.dcnm_service_node: *conf2 register: result tags: sanity - assert: that: - 'result.changed == false' - tags: sanity + tags: sanity + +- name: REPLACED - Replace Service Node with type load balancer + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + 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 }}" + register: result + tags: sanity + +- 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"' + tags: sanity - name: REPLACED - sleep for 20 seconds for DCNM to completely update the state wait_for: timeout: 20 - tags: sanity + tags: sanity -######################################################### +- name: REPLACED - Replace Service Node with type virtual network function + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + 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 }}" + register: result + tags: sanity -- name: OVERRIDDEN - Clean up any existing service node +- 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"' + tags: sanity + +- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state + wait_for: + timeout: 20 + tags: sanity + +- name: REPLACED - Replace Service Node with a new creation of service node, since the sn is not created already + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + 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 }}" + register: result + ignore_errors: yes + tags: sanity + +- 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 - 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: OVERRIDDEN - Query fabric state before proceeding +- name: REPLACED - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -171,9 +261,12 @@ - 'result.response|length == 0' retries: 10 delay: 5 - tags: sanity -- name: OVERRIDDEN - Create Service Node with 2 switches and vPC Interface with type firewall +############################################### +### OVERRIDDEN ## +############################################### + +- name: OVERRIDDEN - Create 2 Service Nodes cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -182,11 +275,17 @@ - name: SN-11 type: firewall form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" + 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_switch4 }}" - - "{{ ansible_switch5 }}" + - "{{ ansible_switch2 }}" register: result tags: sanity @@ -195,38 +294,49 @@ - '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.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.interfaceName == "svc11"' - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - 'result.response[0].DATA.type == "Firewall"' - 'result.response[0].DATA.name == "SN-11"' - tags: sanity + - '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: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state wait_for: timeout: 20 - tags: sanity - -############################################### -### OVERRIDDEN ## -############################################### + tags: sanity -- name: OVERRIDDEN - Update service node - delete and create - cisco.dcnm.dcnm_service_node: &conf2 +- name: OVERRIDDEN - Create and Delete new service nodes + cisco.dcnm.dcnm_service_node: &conf1 fabric: "{{ ansible_it_fabric }}" 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 }}" + - 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_switch4 }}" - - "{{ ansible_switch5 }}" + - "{{ ansible_switch2 }}" register: result tags: sanity @@ -236,23 +346,34 @@ - '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"' - tags: sanity + - '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: OVERRIDDEN - sleep for 40 seconds for DCNM to completely update the state +- name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state wait_for: - timeout: 40 - tags: sanity + timeout: 20 + tags: sanity -- name: OVERRIDDEN - conf - Idempotence - cisco.dcnm.dcnm_service_node: *conf2 +- name: OVERRIDDEN - conf1 - Idempotence + cisco.dcnm.dcnm_service_node: *conf1 register: result tags: sanity @@ -260,25 +381,20 @@ that: - 'result.changed == false' - 'result.response|length == 0' - tags: sanity - -- name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state - wait_for: - timeout: 20 - tags: sanity + tags: sanity - name: OVERRIDDEN - 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: OVERRIDDEN - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" - state: query + state: query register: result tags: sanity @@ -286,4 +402,111 @@ - 'result.response|length == 0' retries: 10 delay: 5 + +############################################### +### QUERY ## +############################################### + +- name: QUERY - Create Service Node with single switch + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + 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 }}" + register: result + tags: sanity + +- 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"' + tags: sanity + +- name: QUERY - sleep for 20 seconds for DCNM to completely update the state + wait_for: + timeout: 20 + tags: sanity + +- name: QUERY - Query the - Create Service Node with single switch + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + 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 }}" + register: result + tags: sanity + +- 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"' + tags: sanity + +- name: QUERY - Query without the config element + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_ext_fabric }}" + state: query + tags: sanity + +- 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"' + tags: sanity + +- name: QUERY - Clean up any existing service node + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_ext_fabric }}" + state: deleted tags: sanity + +- name: QUERY - Query fabric state before proceeding + cisco.dcnm.dcnm_service_node: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_ext_fabric }}" + state: query + register: result + tags: sanity + + until: + - 'result.response|length == 0' + retries: 10 + delay: 5 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 4db54bbcf..fdd3a8958 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tasks/dcnm.yaml @@ -5,19 +5,23 @@ patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases + tags: sanity - 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 }}" + tags: sanity - name: run test cases (connection=httpapi) include: "{{ 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: @@ -25,11 +29,13 @@ service_fabric: "{{ ansible_it_service_fabric }}" state: deleted register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: Cleanup - Delete Service Nodes cisco.dcnm.dcnm_service_node: &conf @@ -52,15 +58,18 @@ switches: - "{{ ansible_switch1 }}" register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: Cleanup - sleep for 40 seconds for DCNM to completely update the state wait_for: timeout: 40 + tags: sanity - name: Cleanup - Delete all VRFs cisco.dcnm.dcnm_vrf: @@ -124,8 +133,10 @@ - ip_address: "{{ ansible_switch1 }}" - ip_address: "{{ ansible_switch2 }}" register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/sanity.yaml new file mode 100644 index 000000000..05c90f53e --- /dev/null +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/sanity.yaml @@ -0,0 +1,332 @@ +############################################## +## SETUP ## +############################################## + +- name: Remove local log file + local_action: command rm -f srp.log + tags: sanity + +- name: Delete route peerings + cisco.dcnm.dcnm_service_route_peering: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_it_service_fabric }}" + state: deleted + register: result + tags: sanity + +- assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + tags: sanity + + +- tags: sanity + block: + +############################################## +## MERGE ## +############################################## + + - name: Create different non-existing service route peerings including all objects + cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_it_service_fabric }}" + 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: # + vrf: "{{ ansible_vrf_11 }}" # mandatory + name: rp1-sn1-inside-net # mandatory + vlan_id: 101 # mandatory + profile: + ipv4_gw: 192.161.1.1/24 # mandatory + ipv6_gw: 2001:db01::1/64 # optional, default is '' + vlan_name: rp1-sn1-inside # optional, default is '' + int_descr: "RP1 SN1 inside interface" # optional, default is '' + tag: 11111 # optional, default is 12345 + next_hop: 192.161.1.100 # mandatory + outside_network: # + vrf: "{{ ansible_vrf_11 }}" # mandatory + name: rp1-sn1-outside-net # mandatory + vlan_id: 102 # mandatory + profile: + ipv4_gw: 192.161.2.1/24 # mandatory + ipv6_gw: 2001:db02::1/64 # optional, default is '' + vlan_name: rp1-sn1-outside # optional, default is '' + int_descr: "RP1 SN1 outside interface" # optionL, default is '' + tag: 11112 # optional, default is 12345 + reverse_next_hop: 192.161.2.100 # optional, default is '' + + - name: IT-FW-RP2 # mandatory + node_name: "{{ ansible_snode_1 }}" # mandatory + deploy_mode: inter_tenant_fw # mandatory, choices=[intra_tenant_fw, inter_tenant_fw] + peering_option: static # optional, default is static, choices=[static, ebgp] + inside_network: # + vrf: "{{ ansible_vrf_21 }}" # mandatory + name: rp2-sn1-inside-net # mandatory + vlan_id: 201 # mandatory + profile: + ipv4_gw: 192.162.1.1/24 # mandatory + ipv6_gw: 2002:db01::1/64 # optional, default is '' + vlan_name: rp2-sn1-inside # optional, default is '' + int_descr: "RP2 SN1 inside interface" # optional, default is '' + static_route: # optional, default is '' + - subnet: 20.20.20.0/24 + next_hop: + - 120.120.120.100 + - 121.121.121.100 + tag: 21111 # optional, default is 12345 + outside_network: # + vrf: "{{ ansible_vrf_22 }}" # mandatory + name: rp2-sn1-outside-net # mandatory + vlan_id: 202 # mandatory + profile: + ipv4_gw: 192.162.2.1/24 # mandatory + ipv6_gw: 2002:db02::1/64 # optional, default is '' + vlan_name: rp2-sn1-outside # optional, default is '' + int_descr: "RP2 SN1 outside interface" # optional, default is '' + static_route: # optional, default is '' + - subnet: 21.21.21.0/24 + next_hop: + - 122.122.122.100 + - 123.123.123.100 + tag: 22222 # optional, default is 12345 + + - name: IT-FW-RP3 # mandatory + node_name: "{{ ansible_snode_1 }}" # mandatory + deploy_mode: inter_tenant_fw # mandatory, choices=[intra_tenant_fw, inter_tenant_fw] + peering_option: ebgp # optional, default is static, choices=[static, ebgp] + inside_network: + vrf: "{{ ansible_vrf_31 }}" # mandatory + name: rp3-sn1-inside-net # mandatory + vlan_id: 301 # mandatory + profile: + ipv4_gw: 192.163.1.1/24 # mandatory + ipv6_gw: 2003:db01::1/64 # optional, default is '' + vlan_name: rp3-sn1-inside # optional, default is '' + int_descr: "RP3 SN1 inside interface" # optional, default is '' + tag: 31111 # optional, default is 12345 + ipv4_neighbor: 31.31.31.1 # mandatory + ipv4_lo: 31.5.1.2 # mandatory + ipv4_vpc_peer_lo: 31.5.1.3 # optional, default is '' + ipv6_neighbor: 2003:3131::1 # optional, default is '' + ipv6_lo: 2003:0502::1 # optional, default is '' + ipv6_vpc_peer_lo: 2003:0503::1 # optional, default is '' + route_map_tag: 33111 # optional, default is 12345 + neigh_int_descr: "RP3 SN1 inside interface" # optional, default is '' + local_asn: 65301 # optional, default is '' + adv_host: true # optional, default is false + outside_network: + vrf: "{{ ansible_vrf_32 }}" # mandatory + name: rp3-sn1-outside-net # mandatory + vlan_id: 302 # mandatory + profile: + ipv4_gw: 192.163.2.1/24 # mandatory + ipv6_gw: 2003:db02::1/64 # optional, default is '' + vlan_name: rp3-sn1-outside # optional, default is '' + int_descr: "RP3 SN1 outside interface" # optional, default is '' + tag: 31112 # optional, default is 12345 + ipv4_neighbor: 131.131.131.1 # mandatory + ipv4_lo: 131.5.1.2 # mandatory + ipv4_vpc_peer_lo: 131.5.1.3 # optional, default is '' + ipv6_neighbor: 2003:8383::1 # optional, default is '' + ipv6_lo: 2003:0504::1 # optional, default is '' + ipv6_vpc_peer_lo: 2003:0505::1 # optional, default is '' + route_map_tag: 31113 # optional, default is 12345 + neigh_int_descr: "RP3 SN1 outside interface" # optional, default is '' + local_asn: 65302 # optional, default is '' + adv_host: true # optional, default is false + + - name: IT-ADC-RP4 + 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: + vrf: "{{ ansible_vrf_41 }}" # mandatory + name: rp4-sn2-first-arm # mandatory + vlan_id: 401 # mandatory + profile: + ipv4_gw: 192.164.1.1/24 # mandatory + ipv6_gw: 2004:db01::1/64 # optional, default is '' + vlan_name: rp4-sn2-first-arm # optional, default is '' + int_descr: "RP4 SN2 first arm intf" # optional, default is '' + tag: 41111 # optional, default is 12345 + ipv4_neighbor: 41.41.41.1 # mandatory + ipv4_lo: 41.5.1.2 # mandatory + ipv4_vpc_peer_lo: 41.5.1.3 # optional, default is '' + ipv6_neighbor: 2004:4141::1 # optional, default is '' + ipv6_lo: 2004:0502::1 # optional, default is '' + ipv6_vpc_peer_lo: 2004:0503::1 # optional, default is '' + route_map_tag: 41112 # optional, default is 12345 + neigh_int_descr: "RP4 SN2 first arm" # optional, default is '' + local_asn: 65401 # optional, default is '' + adv_host: true # optional, default is false + reverse_next_hop: 192.164.1.100 # mandatory + + - name: IT-ADC-RP5 + 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: + vrf: "{{ ansible_vrf_51 }}" # mandatory + name: rp5-sn2-first-arm # mandatory + vlan_id: 501 # mandatory + profile: + ipv4_gw: 192.165.1.1/24 # mandatory + ipv6_gw: 2005:db01::1/64 # optional, default is '' + vlan_name: rp5-sn2-first-arm # optional, default is '' + int_descr: "RP5 SN2 first arm intf" # optional, default is '' + tag: 51111 # optional, default is 12345 + ipv4_neighbor: 51.51.51.1 # mandatory + ipv4_lo: 51.5.1.2 # mandatory + ipv4_vpc_peer_lo: 51.5.1.3 # optional, default is '' + ipv6_neighbor: 2005:5151::1 # optional, default is '' + ipv6_lo: 2005:0502::1 # optional, default is '' + ipv6_vpc_peer_lo: 2005:0503::1 # optional, default is '' + route_map_tag: 51115 # optional, default is 12345 + neigh_int_descr: "RP5 SN2 first arm" # optional, default is '' + local_asn: 65501 # optional, default is '' + adv_host: true # optional, default is false + second_arm: + vrf: "{{ ansible_vrf_51 }}" # mandatory + name: rp5-sn2-second-arm # mandatory + vlan_id: 502 # mandatory + profile: + ipv4_gw: 192.165.2.1/24 # mandatory + ipv6_gw: 2005:db02::1/64 # optional, default is '' + vlan_name: rp5-sn2-second-arm # optional, default is '' + int_descr: "RP5 SN2 second arm intf" # optional, default is '' + tag: 51112 # optional, default is 12345 + reverse_next_hop: 192.165.1.100 # mandatory + + - name: IT-ADC-RP6 + 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: + vrf: "{{ ansible_vrf_61 }}" # mandatory + name: rp6-sn2-first-arm # mandatory + vlan_id: 601 # mandatory + profile: + ipv4_gw: 192.166.1.1/24 # mandatory + ipv6_gw: 2006:db01::1/64 # optional, default is '' + vlan_name: rp6-sn2-first-arm # optional, default is '' + int_descr: "RP6 SN2 first arm intf" # optional, default is '' + tag: 61111 # optional, default is 12345 + static_route: # optional, default is '' + - subnet: 61.61.61.1/24 + next_hop: + - 161.161.161.1 + - 162.162.162.1 + - subnet: 22.0.0.0/24 + next_hop: + - 163.163.163.1 + - 164.164.164.1 + reverse_next_hop: 192.166.1.100 # mandatory + + - name: IT-ADC-RP7 + node_name: "{{ ansible_snode_2 }}" # mandatory + deploy_mode: two_arm_adc # mandatory, choices=[one_arm_adc, two_arm_adc] + peering_option: static # optional, default is static, choices=[static, ebgp] + first_arm: + vrf: "{{ ansible_vrf_71 }}" # mandatory + name: rp7-sn2-first-arm # mandatory + vlan_id: 701 # mandatory + profile: + ipv4_gw: 192.167.1.1/24 # mandatory + ipv6_gw: 2007:db01::1/64 # optional, default is '' + vlan_name: rp7-sn2-first-arm # optional, default is '' + int_descr: "RP6 SN2 first arm intf" # optional, default is '' + tag: 71111 # optional, default is 12345 + static_route: # optional, default is '' + - subnet: 71.71.71.1/24 + next_hop: + - 171.171.171.1 + - 172.172.172.1 + second_arm: + vrf: "{{ ansible_vrf_71 }}" # mandatory + name: rp7-sn2-second-arm # mandatory + vlan_id: 702 # mandatory + profile: + ipv4_gw: 192.167.2.1/24 # mandatory + ipv6_gw: 2007:db02::1/64 # optional, default is '' + vlan_name: rp7-sn2-second-arm # optional, default is '' + int_descr: "RP7 SN2 second arm intf" # optional, default is '' + tag: 71112 # optional, default is 12345 + reverse_next_hop: 192.167.1.100 # mandatory + attach: true + deploy: true + state: merged + register: result + + - assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 7' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["modified"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 7' + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + + - name: Create service route peerings - Idempotence + cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_all + 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' + +############################################## +## CLEANUP ## +############################################## + + always: + + + - name: Delete all created route peerings + cisco.dcnm.dcnm_service_route_peering: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_it_service_fabric }}" + config: + - name: IT-FW-RP1 # mandatory + node_name: "{{ ansible_snode_1 }}" # mandatory + + - name: IT-FW-RP2 # mandatory + node_name: "{{ ansible_snode_1 }}" # mandatory + + - name: IT-FW-RP3 # mandatory + node_name: "{{ ansible_snode_1 }}" # mandatory + + - name: IT-ADC-RP4 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + + - name: IT-ADC-RP5 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + + - name: IT-ADC-RP6 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + + - name: IT-ADC-RP7 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + + state: deleted + register: result + when: IT_CONTEXT is not defined + + - assert: + that: + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml index 5fb352aa9..09b6fbf2b 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml @@ -134,6 +134,7 @@ config: - name: template_101 description: "Template_101 - added this description" + tags: "internal policy 101" content: | telemetry certificate /bootflash/telegraf.crt telegraf @@ -230,14 +231,14 @@ ## CLEANUP ## ############################################## -- name: Initialize the setup - 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 + - name: Initialize the setup + 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 ############################################## ## NO DELETE ## @@ -312,8 +313,6 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - ############################################## ## QUERY ## ############################################## @@ -339,7 +338,7 @@ - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 5' + - '(result["diff"][0]["query"] | length) == 1' - '"template_inuse_1" in result["template-policy-map"].keys()' ############################################## @@ -347,7 +346,7 @@ ############################################## - name: Create templates - cisco.dcnm.dcnm_template: &temp_merge + cisco.dcnm.dcnm_template: &temp_merge3 state: merged # only choose form [merged, deleted, query] config: - name: test_fail @@ -393,7 +392,7 @@ - name: Create templates - cisco.dcnm.dcnm_template: &temp_merge + cisco.dcnm.dcnm_template: &temp_merge4 state: replaced # only choose form [merged, deleted, query] config: - name: template_101 @@ -421,8 +420,6 @@ - 'result.changed == false' - 'result["msg"] == "value of state must be one of: merged, deleted, query, got: replaced"' - - ############################################## ## DELETED ## ############################################## @@ -442,23 +439,6 @@ register: result - - 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 - - assert: that: - 'result.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 85a0581e7..c77c2b1e8 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml @@ -31,6 +31,12 @@ fabric: "{{ test_fabric }}" state: deleted tags: sanity + +- name: Pause for 20 seconds for NDFC to sync + ansible.builtin.pause: + seconds: 20 + tags: sanity + ############################################### ### MERGED ## ############################################### @@ -95,6 +101,11 @@ state: deleted tags: sanity +- name: Pause for 20 seconds for NDFC to sync + ansible.builtin.pause: + seconds: 20 + tags: sanity + ############################################### ### REPLACED ## ############################################### @@ -244,6 +255,11 @@ state: deleted tags: sanity +- name: Pause for 20 seconds for NDFC to sync + ansible.builtin.pause: + seconds: 20 + tags: sanity + ############################################### ### OVERRIDDEN ## ############################################### @@ -357,6 +373,11 @@ state: deleted tags: sanity +- name: Pause for 20 seconds for NDFC to sync + ansible.builtin.pause: + seconds: 20 + tags: sanity + ############################################### ### QUERY ## ############################################### @@ -442,6 +463,11 @@ register: result tags: sanity +- name: Pause for 20 seconds for NDFC to sync + ansible.builtin.pause: + seconds: 20 + tags: sanity + ############################################### ### DELETED ## ############################################### diff --git a/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml index 42229bd32..b86aacf39 100644 --- a/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml @@ -194,18 +194,21 @@ ## register: result + tags: sanity - assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' + tags: sanity - 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 @@ -225,18 +228,21 @@ ## register: result + tags: sanity - assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' + tags: sanity - 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 - name: Create telemetry policy @@ -253,6 +259,7 @@ deploy: true state: merged register: result + tags: sanity - assert: that: @@ -261,16 +268,18 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' + tags: sanity # Assert for Create responses - assert: that: - 'item["RETURN_CODE"] == 200' - - '"is created successfully" in item["DATA"]["successList"][0]["message"]' + - '"Success" in item["DATA"]["successList"][0]["status"]' when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: index_var: my_idx + tags: sanity # Assert for deploy responses - assert: @@ -281,3 +290,4 @@ loop: '{{ result.response }}' loop_control: index_var: my_idx + tags: sanity 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 50867eb87..339f49bab 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 @@ -8,11 +8,13 @@ service_fabric: "{{ ansible_it_service_fabric }}" state: deleted register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: Initialize the setup - Delete Service Nodes cisco.dcnm.dcnm_service_node: &conf @@ -35,11 +37,13 @@ switches: - "{{ ansible_switch1 }}" register: result + tags: sanity - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' + tags: sanity - name: Initialize the setup - Delete VRFs cisco.dcnm.dcnm_vrf: @@ -103,17 +107,21 @@ - ip_address: "{{ ansible_switch1 }}" - ip_address: "{{ ansible_switch2 }}" register: result + tags: sanity - 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: timeout: 10 + tags: sanity -- block: +- tags: sanity + block: ############################################## ## MERGE VRFs ## @@ -220,4 +228,4 @@ - name: Initialize the setup - sleep for 180 seconds for DCNM to completely update the state wait_for: - timeout: 180 \ No newline at end of file + 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 363281adc..ba64b7fc2 100644 --- a/tests/integration/targets/prepare_dcnm_template/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_template/tasks/main.yaml @@ -33,9 +33,8 @@ - name: template_inuse_1 - name: template_inuse_2 - name: my_feature_telemetry - tags: sanity - register: result + tags: sanity - assert: that: @@ -86,7 +85,7 @@ subscription 8 dst-grp 8 snsr-grp 8 sample-interval 8000 - tags: sanity + 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 @@ -106,18 +105,22 @@ ## register: result + tags: sanity + - assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' + tags: sanity - 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 - name: Create telemetry policy @@ -133,6 +136,7 @@ deploy: true state: merged register: result + tags: sanity - assert: that: @@ -141,16 +145,18 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' + tags: sanity # Assert for Create responses - assert: that: - 'item["RETURN_CODE"] == 200' - - '"is created successfully" in item["DATA"]["successList"][0]["message"]' + - '"Success" in item["DATA"]["successList"][0]["status"]' when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: index_var: my_idx + tags: sanity # Assert for deploy responses - assert: @@ -161,6 +167,7 @@ loop: '{{ result.response }}' loop_control: index_var: my_idx + tags: sanity - name: Create and deploy the policies using created templates cisco.dcnm.dcnm_policy: @@ -179,6 +186,7 @@ deploy: true state: merged register: result + tags: sanity - assert: that: @@ -187,16 +195,18 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' + tags: sanity # Assert for Create responses - assert: that: - 'item["RETURN_CODE"] == 200' - - '"is created successfully" in item["DATA"]["successList"][0]["message"]' + - '"Success" in item["DATA"]["successList"][0]["status"]' when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: index_var: my_idx + tags: sanity # Assert for deploy responses - assert: diff --git a/tests/unit/modules/dcnm/test_dcnm_network.py.save b/tests/unit/modules/dcnm/test_dcnm_network.py.save new file mode 100644 index 000000000..9a54ba605 --- /dev/null +++ b/tests/unit/modules/dcnm/test_dcnm_network.py.save @@ -0,0 +1,741 @@ +# Copyright (c) 2023 Cisco and/or its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from unittest.mock import patch + +# from units.compat.mock import patch + +from ansible_collections.cisco.dcnm.plugins.modules import dcnm_network +from .dcnm_module import TestDcnmModule, set_module_args, loadPlaybookData + +import json +import copy +import os +import pprint + +env_var=os.environ +print("environment print(dict(env_var)) + +class TestDcnmNetworkModule(TestDcnmModule): + + module = dcnm_network + + test_data = loadPlaybookData("dcnm_network") + + SUCCESS_RETURN_CODE = 200 + + version = 11 + + mock_ip_sn = test_data.get("mock_ip_sn") + net_inv_data = test_data.get("net_inv_data") + fabric_details = test_data.get("fabric_details") + + playbook_config = test_data.get("playbook_config") + playbook_config_incorrect_netid = test_data.get("playbook_config_incorrect_netid") + playbook_config_incorrect_vrf = test_data.get("playbook_config_incorrect_vrf") + playbook_config_update = test_data.get("playbook_config_update") + playbook_config_novlan = test_data.get("playbook_config_novlan") + + playbook_config_replace = test_data.get("playbook_config_replace") + playbook_config_replace_no_atch = test_data.get("playbook_config_replace_no_atch") + playbook_config_override = test_data.get("playbook_config_override") + mock_net_attach_object_del_not_ready = test_data.get( + "mock_net_attach_object_del_not_ready" + ) + mock_net_attach_object_del_ready = test_data.get("mock_net_attach_object_del_ready") + + attach_success_resp = test_data.get("attach_success_resp") + attach_success_resp2 = test_data.get("attach_success_resp2") + deploy_success_resp = test_data.get("deploy_success_resp") + error1 = test_data.get("error1") + error2 = test_data.get("error2") + error3 = test_data.get("error3") + get_have_failure = test_data.get("get_have_failure") + + delete_success_resp = test_data.get("delete_success_resp") + blank_data = test_data.get("blank_data") + + def init_data(self): + # Some of the mock data is re-initialized after each test as previous test might have altered portions + # of the mock data. + + self.mock_net_object = copy.deepcopy(self.test_data.get("mock_net_object")) + self.mock_vrf_object = copy.deepcopy(self.test_data.get("mock_vrf_object")) + self.mock_net_attach_object = copy.deepcopy(self.test_data.get("mock_net_attach_object")) + self.mock_net_attach_object_pending = copy.deepcopy( + self.test_data.get("mock_net_attach_object_pending") + ) + self.mock_net_query_object = copy.deepcopy(self.test_data.get("mock_net_query_object")) + self.mock_vlan_get = copy.deepcopy(self.test_data.get("mock_vlan_get")) + + def setUp(self): + super(TestDcnmNetworkModule, self).setUp() + + self.mock_dcnm_ip_sn = patch( + "ansible_collections.cisco.dcnm.plugins.modules.dcnm_network.get_fabric_inventory_details" + ) + self.run_dcnm_ip_sn = self.mock_dcnm_ip_sn.start() + + self.mock_dcnm_send = patch( + "ansible_collections.cisco.dcnm.plugins.modules.dcnm_network.dcnm_send" + ) + self.run_dcnm_send = self.mock_dcnm_send.start() + + self.mock_dcnm_fabric_details = patch( + "ansible_collections.cisco.dcnm.plugins.modules.dcnm_network.get_fabric_details" + ) + self.run_dcnm_fabric_details = self.mock_dcnm_fabric_details.start() + + self.mock_dcnm_version_supported = patch( + "ansible_collections.cisco.dcnm.plugins.modules.dcnm_network.dcnm_version_supported" + ) + self.run_dcnm_version_supported = self.mock_dcnm_version_supported.start() + + self.mock_dcnm_get_url = patch( + "ansible_collections.cisco.dcnm.plugins.modules.dcnm_network.dcnm_get_url" + ) + self.run_dcnm_get_url = self.mock_dcnm_get_url.start() + + def tearDown(self): + super(TestDcnmNetworkModule, self).tearDown() + self.mock_dcnm_send.stop() + self.mock_dcnm_ip_sn.stop() + self.mock_dcnm_fabric_details.stop() + self.mock_dcnm_version_supported.stop() + self.mock_dcnm_get_url.stop() + + def load_fixtures(self, response=None, device=""): + + if self.version == 12: + self.run_dcnm_version_supported.return_value = 12 + else: + self.run_dcnm_version_supported.return_value = 11 + + if "net_blank_fabric" in self._testMethodName: + self.run_dcnm_ip_sn.side_effect = [{}] + else: + self.run_dcnm_ip_sn.side_effect = [self.net_inv_data] + + self.run_dcnm_fabric_details.side_effect = [self.fabric_details] + + if "get_have_failure" in self._testMethodName: + self.run_dcnm_send.side_effect = [self.get_have_failure] + + elif "_check_mode" in self._testMethodName: + self.init_data() + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.blank_data, + ] + + elif "_12check_mode" in self._testMethodName: + self.init_data() + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.blank_data, + ] + + elif "_merged_new" in self._testMethodName: + self.init_data() + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.blank_data, + self.blank_data, + self.attach_success_resp, + self.deploy_success_resp, + ] + + elif "_12merged_new" in self._testMethodName: + self.init_data() + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.blank_data, + self.blank_data, + self.attach_success_resp, + self.deploy_success_resp, + ] + + elif "_merged_novlan_new" in self._testMethodName: + self.init_data() + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.blank_data, + self.mock_vlan_get, + self.blank_data, + self.attach_success_resp, + self.deploy_success_resp, + ] + + elif "error1" in self._testMethodName: + self.init_data() + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.blank_data, + self.blank_data, + self.error1, + self.blank_data, + ] + + elif "error2" in self._testMethodName: + self.init_data() + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.blank_data, + self.blank_data, + self.error2, + self.blank_data, + ] + elif "error3" in self._testMethodName: + self.init_data() + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.blank_data, + self.blank_data, + self.attach_success_resp, + self.error3, + self.blank_data, + ] + + elif "_merged_duplicate" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + ] + + elif "_merged_with_incorrect_netid" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + ] + + elif "_merged_with_incorrect_vrf" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + ] + + elif "_merged_with_update" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + self.blank_data, + self.attach_success_resp, + self.deploy_success_resp, + ] + + elif "replace_with_no_atch" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + self.attach_success_resp, + self.deploy_success_resp, + self.delete_success_resp, + ] + + elif "replace_with_changes" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + self.attach_success_resp, + self.deploy_success_resp, + self.delete_success_resp, + ] + + elif "replace_without_changes" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + ] + + elif "_merged_redeploy" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object_pending] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + self.blank_data, + self.deploy_success_resp, + ] + + elif "override_with_additions" in self._testMethodName: + self.init_data() + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.blank_data, + self.blank_data, + self.attach_success_resp, + self.deploy_success_resp, + ] + + elif "override_without_changes" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + ] + + elif "override_with_deletions" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + self.attach_success_resp, + self.deploy_success_resp, + self.mock_net_attach_object_del_not_ready, + self.mock_net_attach_object_del_ready, + self.mock_net_attach_object_del_ready, + self.delete_success_resp, + self.blank_data, + self.attach_success_resp2, + self.deploy_success_resp, + ] + + elif "delete_std" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + self.blank_data, + self.attach_success_resp, + self.deploy_success_resp, + self.mock_net_attach_object_del_not_ready, + self.mock_net_attach_object_del_ready, + self.mock_net_attach_object_del_ready, + self.delete_success_resp, + ] + + elif "delete_without_config" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + self.blank_data, + self.attach_success_resp, + self.deploy_success_resp, + self.mock_net_attach_object_del_not_ready, + self.mock_net_attach_object_del_ready, + self.mock_net_attach_object_del_ready, + self.delete_success_resp, + ] + + elif "query_with_config" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + self.mock_vrf_object, + self.mock_net_query_object, + self.mock_net_attach_object + ] + + elif "query_without_config" in self._testMethodName: + self.init_data() + self.run_dcnm_get_url.side_effect = [self.mock_net_attach_object] + self.run_dcnm_send.side_effect = [ + self.mock_vrf_object, + self.mock_net_object, + self.mock_vrf_object, + self.mock_net_object, + self.mock_net_attach_object + ] + + else: + pass + + def test_dcnm_net_blank_fabric(self): + set_module_args( + dict(state="merged", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=False, failed=True) + self.assertEqual( + result.get("msg"), + "Fabric test_network missing on DCNM or does not have any switches", + ) + + def test_dcnm_net_get_have_failure(self): + set_module_args( + dict(state="merged", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=False, failed=True) + self.assertEqual(result.get("msg"), "Fabric test_network not present on DCNM") + + def test_dcnm_net_check_mode(self): + set_module_args( + dict( + _ansible_check_mode=True, + state="merged", + fabric="test_network", + config=self.playbook_config, + ) + ) + result = self.execute_module(changed=False, failed=False) + self.assertTrue(result.get("diff")) + self.assertFalse(result.get("response")) + + def test_dcnm_net_12check_mode(self): + self.version = 12 + set_module_args( + dict( + _ansible_check_mode=True, + state="merged", + fabric="test_network", + config=self.playbook_config, + ) + ) + result = self.execute_module(changed=False, failed=False) + self.version = 11 + self.assertTrue(result.get("diff")) + self.assertFalse(result.get("response")) + + def test_dcnm_net_merged_new(self): + set_module_args( + dict(state="merged", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=True, failed=False) + self.assertTrue(result.get("diff")[0]["attach"][0]["deploy"]) + self.assertTrue(result.get("diff")[0]["attach"][1]["deploy"]) + self.assertEqual( + result.get("diff")[0]["attach"][0]["ip_address"], "10.10.10.217" + ) + + def test_dcnm_net_12merged_new(self): + self.version = 12 + set_module_args( + dict(state="merged", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=True, failed=False) + self.version = 11 + self.assertTrue(result.get("diff")[0]["attach"][0]["deploy"]) + self.assertTrue(result.get("diff")[0]["attach"][1]["deploy"]) + self.assertEqual( + result.get("diff")[0]["attach"][0]["ip_address"], "10.10.10.217" + ) + + def test_dcnm_net_merged_novlan_new(self): + set_module_args( + dict(state="merged", fabric="test_network", config=self.playbook_config_novlan) + ) + result = self.execute_module(changed=True, failed=False) + self.assertTrue(result.get("diff")[0]["attach"][0]["deploy"]) + self.assertTrue(result.get("diff")[0]["attach"][1]["deploy"]) + self.assertEqual( + result.get("diff")[0]["attach"][0]["ip_address"], "10.10.10.217" + ) + + def test_dcnm_net_error1(self): + set_module_args( + dict(state="merged", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=False, failed=True) + self.assertEqual(result["msg"]["RETURN_CODE"], 400) + self.assertEqual(result["msg"]["ERROR"], "There is an error") + + def test_dcnm_net_error2(self): + set_module_args( + dict(state="merged", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=False, failed=True) + self.assertIn( + "Entered Network VLAN ID 203 is in use already", + str(result["msg"]["DATA"].values()), + ) + + def test_dcnm_net_error3(self): + set_module_args( + dict(state="merged", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=False, failed=False) + self.assertEqual( + result["response"][2]["DATA"], "No switches PENDING for deployment" + ) + + def test_dcnm_net_merged_duplicate(self): + set_module_args( + dict(state="merged", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=False, failed=False) + self.assertFalse(result.get("diff")) + + def test_dcnm_net_merged_with_incorrect_netid(self): + set_module_args( + dict( + state="merged", + fabric="test_network", + config=self.playbook_config_incorrect_netid, + ) + ) + result = self.execute_module(changed=False, failed=True) + self.assertEqual( + result.get("msg"), + "networkId can not be updated on existing network: test_network", + ) + + def test_dcnm_net_merged_with_incorrect_vrf(self): + set_module_args( + dict( + state="merged", + fabric="test_network", + config=self.playbook_config_incorrect_vrf, + ) + ) + result = self.execute_module(changed=False, failed=True) + self.assertEqual( + result.get("msg"), + "VRF: ansible-vrf-int2 is missing in fabric: test_network", + ) + + def test_dcnm_net_merged_with_update(self): + set_module_args( + dict( + state="merged", fabric="test_network", config=self.playbook_config_update + ) + ) + result = self.execute_module(changed=True, failed=False) + self.assertTrue(result.get("diff")[0]["attach"][0]["deploy"]) + self.assertTrue(result.get("diff")[0]["attach"][1]["deploy"]) + self.assertEqual( + result.get("diff")[0]["attach"][0]["ip_address"], "10.10.10.226" + ) + self.assertEqual( + result.get("diff")[0]["attach"][1]["ip_address"], "10.10.10.227" + ) + self.assertEqual(result.get("diff")[0]["vrf_name"], "ansible-vrf-int1") + + def test_dcnm_net_replace_with_changes(self): + set_module_args( + dict( + state="replaced", + fabric="test_network", + config=self.playbook_config_replace, + ) + ) + result = self.execute_module(changed=True, failed=False) + self.assertEqual(result.get("diff")[0]["vlan_id"], 203) + self.assertTrue(result.get("diff")[0]["attach"][0]["deploy"]) + self.assertFalse(result.get("diff")[0]["attach"][1]["deploy"]) + self.assertEqual( + result["response"][0]["DATA"]["test-network--9NN7E41N16A(leaf1)"], "SUCCESS" + ) + self.assertEqual( + result["response"][0]["DATA"]["test-network--9YO9A29F27U(leaf2)"], "SUCCESS" + ) + self.assertEqual(result["response"][1]["DATA"]["status"], "") + self.assertEqual(result["response"][1]["RETURN_CODE"], self.SUCCESS_RETURN_CODE) + + def test_dcnm_net_replace_with_no_atch(self): + set_module_args( + dict( + state="replaced", + fabric="test_network", + config=self.playbook_config_replace_no_atch, + ) + ) + result = self.execute_module(changed=True, failed=False) + self.assertFalse(result.get("diff")[0]["attach"][0]["deploy"]) + self.assertFalse(result.get("diff")[0]["attach"][1]["deploy"]) + self.assertEqual(result.get("diff")[0]["net_name"], "test_network") + self.assertEqual( + result["response"][0]["DATA"]["test-network--9NN7E41N16A(leaf1)"], "SUCCESS" + ) + self.assertEqual( + result["response"][0]["DATA"]["test-network--9YO9A29F27U(leaf2)"], "SUCCESS" + ) + self.assertEqual(result["response"][1]["DATA"]["status"], "") + self.assertEqual(result["response"][1]["RETURN_CODE"], self.SUCCESS_RETURN_CODE) + + def test_dcnm_net_replace_without_changes(self): + set_module_args( + dict(state="replaced", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=False, failed=False) + self.assertFalse(result.get("diff")) + self.assertFalse(result.get("response")) + + def test_dcnm_vrf_merged_redeploy(self): + set_module_args( + dict(state="merged", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=True, failed=False) + self.assertEqual(result.get("diff")[0]["net_name"], "test_network") + + def test_dcnm_net_override_with_additions(self): + set_module_args( + dict(state="overridden", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=True, failed=False) + self.assertTrue(result.get("diff")[0]["attach"][0]["deploy"]) + self.assertTrue(result.get("diff")[0]["attach"][1]["deploy"]) + self.assertEqual( + result.get("diff")[0]["attach"][0]["ip_address"], "10.10.10.217" + ) + self.assertEqual( + result.get("diff")[0]["attach"][1]["ip_address"], "10.10.10.218" + ) + self.assertEqual(result.get("diff")[0]["net_id"], 9008011) + self.assertEqual( + result["response"][1]["DATA"]["test-network--9NN7E41N16A(leaf1)"], "SUCCESS" + ) + self.assertEqual( + result["response"][1]["DATA"]["test-network--9YO9A29F27U(leaf2)"], "SUCCESS" + ) + self.assertEqual(result["response"][2]["DATA"]["status"], "") + self.assertEqual(result["response"][2]["RETURN_CODE"], self.SUCCESS_RETURN_CODE) + + def test_dcnm_net_override_without_changes(self): + set_module_args( + dict(state="overridden", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=False, failed=False) + self.assertFalse(result.get("diff")) + self.assertFalse(result.get("response")) + + def test_dcnm_net_override_with_deletions(self): + set_module_args( + dict( + state="overridden", + fabric="test_network", + config=self.playbook_config_override, + ) + ) + result = self.execute_module(changed=True, failed=False) + self.assertTrue(result.get("diff")[0]["attach"][0]["deploy"]) + self.assertTrue(result.get("diff")[0]["attach"][1]["deploy"]) + self.assertEqual(result.get("diff")[0]["vlan_id"], 303) + self.assertEqual(result.get("diff")[0]["net_id"], 9008012) + + self.assertFalse(result.get("diff")[1]["attach"][0]["deploy"]) + self.assertFalse(result.get("diff")[1]["attach"][1]["deploy"]) + self.assertEqual(result.get("diff")[1]["net_name"], "test_network") + self.assertNotIn("net_id", result.get("diff")[1]) + + self.assertEqual( + result["response"][0]["DATA"]["test-network--9NN7E41N16A(leaf1)"], "SUCCESS" + ) + self.assertEqual( + result["response"][0]["DATA"]["test-network--9YO9A29F27U(leaf2)"], "SUCCESS" + ) + self.assertEqual(result["response"][1]["DATA"]["status"], "") + self.assertEqual(result["response"][1]["RETURN_CODE"], self.SUCCESS_RETURN_CODE) + self.assertEqual( + result["response"][4]["DATA"]["test-network--9YO9A29F27U(leaf2)"], "SUCCESS" + ) + self.assertEqual( + result["response"][4]["DATA"]["test-network--XYZKSJHSMK3(leaf3)"], "SUCCESS" + ) + + def test_dcnm_net_delete_std(self): + set_module_args( + dict(state="deleted", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=True, failed=False) + self.assertFalse(result.get("diff")[0]["attach"][0]["deploy"]) + self.assertFalse(result.get("diff")[0]["attach"][1]["deploy"]) + self.assertEqual(result.get("diff")[0]["net_name"], "test_network") + self.assertNotIn("net_id", result.get("diff")[0]) + + self.assertEqual( + result["response"][0]["DATA"]["test-network--9NN7E41N16A(leaf1)"], "SUCCESS" + ) + self.assertEqual( + result["response"][0]["DATA"]["test-network--9YO9A29F27U(leaf2)"], "SUCCESS" + ) + self.assertEqual(result["response"][1]["DATA"]["status"], "") + self.assertEqual(result["response"][1]["RETURN_CODE"], self.SUCCESS_RETURN_CODE) + + def test_dcnm_net_delete_without_config(self): + set_module_args(dict(state="deleted", fabric="test_network", config=[])) + result = self.execute_module(changed=True, failed=False) + self.assertFalse(result.get("diff")[0]["attach"][0]["deploy"]) + self.assertFalse(result.get("diff")[0]["attach"][1]["deploy"]) + self.assertEqual(result.get("diff")[0]["net_name"], "test_network") + self.assertNotIn("net_id", result.get("diff")[0]) + + self.assertEqual( + result["response"][0]["DATA"]["test-network--9NN7E41N16A(leaf1)"], "SUCCESS" + ) + self.assertEqual( + result["response"][0]["DATA"]["test-network--9YO9A29F27U(leaf2)"], "SUCCESS" + ) + self.assertEqual(result["response"][1]["DATA"]["status"], "") + self.assertEqual(result["response"][1]["RETURN_CODE"], self.SUCCESS_RETURN_CODE) + + def test_dcnm_net_query_with_config(self): + set_module_args( + dict(state="query", fabric="test_network", config=self.playbook_config) + ) + result = self.execute_module(changed=False, failed=False) + self.assertFalse(result.get("diff")) + self.assertEqual(result.get("response")[0]["parent"]["networkName"], "test_network") + self.assertEqual(result.get("response")[0]["parent"]["networkId"], 9008011) + self.assertTrue( + result.get("response")[0]["attach"][0]["deployment"], + ) + self.assertEqual( + result.get("response")[0]["attach"][0]["vlan"], + 202, + ) + self.assertTrue( + result.get("response")[0]["attach"][1]["deployment"], + ) + self.assertEqual( + result.get("response")[0]["attach"][1]["vlan"], + 202, + ) + + def test_dcnm_net_query_without_config(self): + set_module_args( + dict(state="query", fabric="test_network", config=[]) + ) + result = self.execute_module(changed=False, failed=False) + self.assertFalse(result.get("diff")) + self.assertEqual(result.get("response")[0]["parent"]["networkName"], "test_network") + self.assertEqual(result.get("response")[0]["parent"]["networkId"], 9008011) + self.assertTrue( + result.get("response")[0]["attach"][0]["deployment"], + ) + self.assertEqual( + result.get("response")[0]["attach"][0]["vlan"], + 202, + ) + self.assertTrue( + result.get("response")[0]["attach"][1]["deployment"], + ) + self.assertEqual( + result.get("response")[0]["attach"][1]["vlan"], + 202, + ) From a87f5df433e269084cdf552e1ae1b1dc26c64b54 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 09:36:09 +0530 Subject: [PATCH 206/248] Update config.yml --- .circleci/config.yml | 63 +++++++++++--------------------------------- 1 file changed, 16 insertions(+), 47 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a90590120..78c5c2a76 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,9 +28,6 @@ parameters: run-resource_manager: type: boolean default: false -# run-rest: -# type: boolean -# default: false run-service_node: type: boolean default: false @@ -102,19 +99,8 @@ jobs: export PATH="$PYENV_ROOT/shims/python:$PATH" export PYTHONPATH="$PYENV_ROOT/shims/python3:$PYTHONPATH" export PYTHONPATH="$PYENV_ROOT/shims/python:$PYTHONPATH" - #echo "**********************" - # whoami - # echo "**********************" - # echo $PYTHONPATH - # echo $PATH - # echo $HOME - # echo $PYENV_ROOT - # echo "**********************" + pyenv local python_3.11 - # /home/circleci/.pyenv/bin/pyenv versions - # /home/circleci/.pyenv/shims/python --version - # python3 --version - # python --version #pip install https://github.com/ansible/ansible/archive/v<< parameters.ansible_version >>.tar.gz --disable-pip-version-check ansible --version @@ -122,6 +108,7 @@ jobs: ansible-galaxy collection build --force --output-path "${HOME}/.cache/v<< parameters.ansible_version >>/collection-tarballs" pip install pytest==5.4.1 pip install coverage==4.5.4 + pyenv local system addrole: @@ -171,12 +158,8 @@ jobs: pyenv local python_<< parameters.py_version >> - cat dcnm_roles.yaml - - - # ansible-test sanity --docker --python << parameters.py_version >> -v --color --truncate 0 environment: PYTHONPATH: /home/circleci/.ansible/collections/:$PYTHONPATH @@ -201,11 +184,10 @@ jobs: name: Run sanity tests py << parameters.py_version >> command: | export ANSIBLE_ROLES_PATH=/home/circleci/repo/tests/integration/targets/ + export ANSIBLE_PERSISTENT_CONNECT_TIMEOUT=1000 + export ANSIBLE_PERSISTENT_COMMAND_TIMEOUT=1000 env ansible-playbook -i hosts dcnm_roles.yaml --tags sanity -vvvv - # command: ansible-test sanity --python 3.8 -v --color --truncate 0 - # environment: - # PYTHONPATH: /home/circleci/.ansible/collections/ @@ -466,18 +448,18 @@ workflows: -# service_route_peering: -# when: -# or: -# - << pipeline.parameters.run-all >> -# - << pipeline.parameters.run-service_route_peering >> -# jobs: -# - addrole: -# -# matrix: -# parameters: -# modulename: -# - service_route_peering + service_route_peering: + when: + or: + - << pipeline.parameters.run-all >> + - << pipeline.parameters.run-service_route_peering >> + jobs: + - addrole: + + matrix: + parameters: + modulename: + - service_route_peering template: when: @@ -492,19 +474,6 @@ workflows: modulename: - template -# rest: -# when: -# or: -# - << pipeline.parameters.run-all >> -# - << pipeline.parameters.run-rest >> -# jobs: -# - addrole: -# -# matrix: -# parameters: -# modulename: -# - rest - sanity: when: << pipeline.parameters.run-any >> From 75b5357c64d2e2dd23ddc4623a419f03e5741452 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:44:45 +0530 Subject: [PATCH 207/248] Update sanity.yaml --- .../dcnm_interface/tests/dcnm/sanity.yaml | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml index 22ef25a6f..eebf0f4cd 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/sanity.yaml @@ -4,11 +4,11 @@ ## SETUP ## ############################################## -- name: Remove local log file +- name: SANITY- Remove local log file local_action: command rm -f dcnm_intf.log tags: sanity -- name: Put the fabric to default state +- name: SANITY- Put the fabric to default state cisco.dcnm.dcnm_interface: check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -30,7 +30,7 @@ ## MERGE ## ############################################## - - name: Create ethernet interfaces - 1 + - name: SANITY- Create ethernet interfaces - 1 cisco.dcnm.dcnm_interface: ð_merge check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -135,7 +135,7 @@ ## REPLACE ## ############################################## - - name: Replace ethernet interfaces - 1 + - name: SANITY- Replace ethernet interfaces - 1 cisco.dcnm.dcnm_interface: ð_replace check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -228,7 +228,7 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - name: Replace ethernet interfaces - 1 - Idempotence + - name: SANITY- Replace ethernet interfaces - 1 - Idempotence cisco.dcnm.dcnm_interface: *eth_replace register: result @@ -252,7 +252,7 @@ always: - - name: Put fabric to default state + - name: SANITY- Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -274,7 +274,7 @@ ## MERGE ## ############################################## - - name: Create ethernet interfaces - 2 + - name: SANITY- Create ethernet interfaces - 2 cisco.dcnm.dcnm_interface: ð_merge2 check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -379,7 +379,7 @@ ## REPLACE ## ############################################## - - name: Replace ethernet interfaces - 2 + - name: SANITY- Replace ethernet interfaces - 2 cisco.dcnm.dcnm_interface: ð_replace2 check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -472,7 +472,7 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - name: Replace ethernet interfaces - 2 - Idempotence + - name: SANITY- Replace ethernet interfaces - 2 - Idempotence cisco.dcnm.dcnm_interface: *eth_replace2 register: result @@ -496,7 +496,7 @@ always: - - name: Put fabric to default state + - name: SANITY- Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -518,7 +518,7 @@ ## MERGE ## ############################################## - - name: Create port channel interfaces + - name: SANITY- Create port channel interfaces cisco.dcnm.dcnm_interface: &pc_merge check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -609,7 +609,7 @@ ## REPLACE ## ############################################## - - name: Replace port channel interfaces + - name: SANITY- Replace port channel interfaces cisco.dcnm.dcnm_interface: &pc_replace check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -688,7 +688,7 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - name: Replace port channel interfaces - Idempotence + - name: SANITY- Replace port channel interfaces - Idempotence cisco.dcnm.dcnm_interface: *pc_replace register: result @@ -712,7 +712,7 @@ always: - - name: Put fabric to default state + - name: SANITY- Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -734,7 +734,7 @@ ## MERGE ## ############################################## - - name: Create sub-interfaces + - name: SANITY- Create sub-interfaces cisco.dcnm.dcnm_interface: &sub_merge check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -797,7 +797,7 @@ ## REPLACE ## ############################################## - - name: Replace sub-interfaces + - name: SANITY- Replace sub-interfaces cisco.dcnm.dcnm_interface: &sub_replace check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -856,7 +856,7 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - name: Replace sub-interfaces - Idempotence + - name: SANITY- Replace sub-interfaces - Idempotence cisco.dcnm.dcnm_interface: *sub_replace register: result @@ -880,7 +880,7 @@ always: - - name: Put fabric to default state + - name: SANITY- Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -902,7 +902,7 @@ ## MERGE ## ############################################## - - name: Create eth/sub/lo interfaces + - name: SANITY- Create eth/sub/lo interfaces cisco.dcnm.dcnm_interface: check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -975,7 +975,7 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - name: Modify aggregate members like cmds + - name: SANITY- Modify aggregate members like cmds cisco.dcnm.dcnm_interface: check_deploy: True fabric: "{{ ansible_it_fabric }}" @@ -1057,7 +1057,7 @@ always: - - name: Put fabric to default state + - name: SANITY- Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: True fabric: "{{ ansible_svi_fabric }}" From 47eecfed3608e39b198017d32bbdead0dee11566 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:46:39 +0530 Subject: [PATCH 208/248] Update sanity.yaml --- .../dcnm_inventory/tests/dcnm/sanity.yaml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml index 8f58502df..bfa0392db 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml @@ -12,7 +12,7 @@ when: controller_version >= "12" tags: sanity -- name: MERGED - Verify if fabric is deployed. +- name: SANITY- MERGED - Verify if fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" @@ -24,7 +24,7 @@ - 'result.response.DATA != None' tags: sanity -- name: DELETED - setup - Clean up existing devices +- name: SANITY- DELETED - setup - Clean up existing devices cisco.dcnm.dcnm_inventory: fabric: "{{ ansible_it_fabric }}" state: deleted @@ -35,7 +35,7 @@ ## MERGED ## ############################################## -- name: MERGED - Merge a Switch using GreenField Deployment +- name: SANITY- MERGED - Merge a Switch using GreenField Deployment cisco.dcnm.dcnm_inventory: &conf fabric: "{{ ansible_it_fabric }}" state: merged @@ -62,7 +62,7 @@ loop: '{{ result.response }}' tags: sanity -- name: MERGED - conf1 - GF - Idempotence +- name: SANITY- MERGED - conf1 - GF - Idempotence cisco.dcnm.dcnm_inventory: *conf register: result tags: sanity @@ -77,7 +77,7 @@ # QUERY ## ############################################# -- name: QUERY - Query a Switch - Hostname and Role must match +- name: SANITY- QUERY - Query a Switch - Hostname and Role must match cisco.dcnm.dcnm_inventory: fabric: "{{ ansible_it_fabric }}" state: query @@ -100,7 +100,7 @@ ## OVERRIDDEN ## ############################################## -- name: OVERRIDDEN - Update a New Switch using GreenField Deployment - Delete and Create - default role +- name: SANITY- OVERRIDDEN - Update a New Switch using GreenField Deployment - Delete and Create - default role cisco.dcnm.dcnm_inventory: &conf_over fabric: "{{ ansible_it_fabric }}" state: overridden @@ -125,7 +125,7 @@ loop: '{{ result.response }}' tags: sanity -- name: OVERRIDDEN - conf1 - OV - Idempotence +- name: SANITY- OVERRIDDEN - conf1 - OV - Idempotence cisco.dcnm.dcnm_inventory: *conf_over register: result tags: sanity @@ -140,7 +140,7 @@ ## CLEAN-UP ## ############################################## -- name: DELETED - setup - Clean up existing devices +- name: SANITY- DELETED - setup - Clean up existing devices cisco.dcnm.dcnm_inventory: &clean fabric: "{{ ansible_it_fabric }}" state: deleted @@ -154,7 +154,7 @@ register: result tags: sanity -- name: DELETED - conf1 - OV - Idempotence +- name: SANITY- DELETED - conf1 - OV - Idempotence cisco.dcnm.dcnm_inventory: *clean register: result tags: sanity @@ -163,7 +163,7 @@ ## RESET FABRIC ## ############################################## -- name: RESET - setup switches in fabric +- name: SANITY- RESET - setup switches in fabric cisco.dcnm.dcnm_inventory: fabric: "{{ ansible_it_fabric }}" config: From f23fbaa37cac09b368b03cad4ced940cfbc5f65c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:48:11 +0530 Subject: [PATCH 209/248] Update sanity.yaml --- .../targets/dcnm_links/tests/dcnm/sanity.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yaml index 16bfcb847..2ee148afa 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/sanity.yaml @@ -2,7 +2,7 @@ ## SETUP ## ############################################## -- name: Remove local log file +- name: SANITY- Remove local log file local_action: command rm -f dcnm_links.log - tags: sanity @@ -12,7 +12,7 @@ ## DELETE ## ############################################## - - name: 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 }}" @@ -58,7 +58,7 @@ ## MERGE ## ############################################## - - name: Create Links + - name: SANITY- Create Links cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -117,7 +117,7 @@ ## MODIFY ## ############################################## - - name: Merge modified info into existing links + - name: SANITY- Merge modified info into existing links cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -176,7 +176,7 @@ ## REPLACE ## ############################################## - - name: 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 }}" @@ -231,7 +231,7 @@ ## IDEMPOTENCE ## ############################################## - - name: Repalce Links - Idempotence + - name: SANITY- Replace Links - Idempotence cisco.dcnm.dcnm_links: *links_replace register: result @@ -255,7 +255,7 @@ always: - - name: Cleanup - Delete Links + - name: SANITY- Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined From 18affda919525445b4e772620647ad5c15f923c7 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:49:32 +0530 Subject: [PATCH 210/248] Update sanity.yaml --- .../dcnm_network/tests/dcnm/sanity.yaml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml index d32ea4177..9ab8bc7a8 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml @@ -12,7 +12,7 @@ when: controller_version >= "12" tags: sanity -- name: Verify if fabric - Fabric1 is deployed. +- name: SANITY- Verify if fabric - Fabric1 is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" @@ -24,13 +24,13 @@ - 'result.response.DATA != None' tags: sanity -- name: DELETED - setup - Clean up any existing networks +- name: SANITY- DELETED - setup - Clean up any existing networks cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: deleted tags: sanity -- name: MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach +- name: SANITY- MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: merged @@ -64,7 +64,7 @@ register: result tags: sanity -- name: Query fabric state until networkStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until networkStatus transitions to DEPLOYED state cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: query @@ -101,7 +101,7 @@ ## OVERRIDDEN ## ############################################## -- name: OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach +- name: SANITY- OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach cisco.dcnm.dcnm_network: &conf1 fabric: "{{ test_fabric }}" state: overridden @@ -124,7 +124,7 @@ register: result tags: sanity -- name: Query fabric state until networkStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until networkStatus transitions to DEPLOYED state cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: query @@ -171,20 +171,20 @@ - 'result.response|length == 0' tags: sanity -- name: OVERRIDDEN - setup - remove any networks +- name: SANITY- OVERRIDDEN - setup - remove any networks cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: deleted tags: sanity -- name: REPLACED - setup - Clean up any existing networks +- name: SANITY- REPLACED - setup - Clean up any existing networks cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: deleted tags: sanity -- name: REPLACED - Create, Attach and Deploy Multiple Network with Single Switch Attach +- name: SANITY- REPLACED - Create, Attach and Deploy Multiple Network with Single Switch Attach cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: merged @@ -218,7 +218,7 @@ register: result tags: sanity -- name: Query fabric state until networkStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until networkStatus transitions to DEPLOYED state cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: query @@ -255,7 +255,7 @@ ## REPLACED ## ############################################## -- name: REPLACED - Update Network using replace - Delete Attachments +- name: SANITY- REPLACED - Update Network using replace - Delete Attachments cisco.dcnm.dcnm_network: &conf1 fabric: "{{ test_fabric }}" state: replaced @@ -308,7 +308,7 @@ - '"ansible-net13" or "ansible-net12" in result.diff[0].net_name' tags: sanity -- name: REPLACED - conf1 - Idempotence +- name: SANITY- REPLACED - conf1 - Idempotence cisco.dcnm.dcnm_network: *conf1 register: result tags: sanity From e152db73b8ca49896ab60aa48a0dfe93e3a423fb Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:53:06 +0530 Subject: [PATCH 211/248] Update sanity.yaml --- .../dcnm_policy/tests/dcnm/sanity.yaml | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yaml index f1c56dc31..f61b3bd13 100644 --- a/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/sanity.yaml @@ -2,11 +2,11 @@ ## SETUP ## ############################################## -- name: Remove local log file +- name: SANITY- Remove local log file local_action: command rm -f policy.log tags: sanity -- name: Put the fabric to default state +- name: SANITY- Put the fabric to default state cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" state: deleted # only choose form [merged, deleted, query] @@ -35,7 +35,7 @@ ## MERGE ## ############################################## - - name: Create different non-existing policies + - name: SANITY- Create different non-existing policies cisco.dcnm.dcnm_policy: &dcnm_pol fabric: "{{ ansible_it_fabric }}" deploy: true @@ -93,7 +93,7 @@ loop_control: index_var: my_idx - - name: Setting fact + - name: SANITY- Setting fact set_fact: modify_policy_list: "{{ ( modify_policy_list | default([])) + [item['DATA']['successList'][0]['message'].split(' ')[0]] }}" when: (my_idx < (result["diff"][0]["merged"] | length)) @@ -101,18 +101,18 @@ loop_control: index_var: my_idx - - name: Show the policy_list information + - name: SANITY- Show the policy_list information debug: var: modify_policy_list - - name: Setting fact + - name: SANITY- Setting fact set_fact: list_len: "{{ modify_policy_list | length }}" ############################################## ## QUERY ## ############################################## - - name: Query all policies from the specified switches + - name: SANITY- Query all policies from the specified switches cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" state: query @@ -130,7 +130,7 @@ - '(result["diff"][0]["deploy"] | length) == 0' - '(result["response"] | length) != 0' - - name: Query specific policies + - name: SANITY- Query specific policies cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" state: query @@ -157,7 +157,7 @@ ## MODIFY ## ############################################## - - name: Modify existing policy using template name - should create the policy + - name: SANITY- Modify existing policy using template name - should create the policy cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" deploy: true @@ -179,7 +179,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - - name: Modify policies - using policy IDs + - name: SANITY- Modify policies - using policy IDs cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" state: merged @@ -228,7 +228,7 @@ always: - - name: Delete all created policies + - name: SANITY- Delete all created policies cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" state: deleted # only choose form [merged, deleted, query] From a0410c163d630e528bb4ef4a268ffe8251a23b3e Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:55:09 +0530 Subject: [PATCH 212/248] Update sanity.yaml --- .../dcnm_resource_manager/tests/dcnm/sanity.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yaml index f9db01118..6b634bd37 100644 --- a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/sanity.yaml @@ -2,11 +2,11 @@ ## SETUP ## ############################################## -- name: Remove local log file +- name: SANITY- Remove local log file local_action: command rm -f res_mgr.log tags: sanity -- name: Delete Resources +- name: SANITY- Delete Resources cisco.dcnm.dcnm_resource_manager: &rm_delete state: deleted # choose form [merged, deleted, query] fabric: "{{ ansible_it_fabric }}" @@ -71,7 +71,7 @@ ## MERGE ## ############################################## - - name: Create Resources + - name: SANITY- Create Resources cisco.dcnm.dcnm_resource_manager: &rm_merge state: merged # choose form [merged, deleted, query] fabric: "{{ ansible_it_fabric }}" @@ -145,7 +145,7 @@ ## QUERY ## ############################################## - - name: Query all Resources - no filters + - name: SANITY- Query all Resources - no filters cisco.dcnm.dcnm_resource_manager: state: query # choose form [merged, deleted, query] fabric: "{{ ansible_it_fabric }}" @@ -155,7 +155,7 @@ that: - '(result["response"] | length) != 0' - - name: Creating entity_names + - name: SANITY- Creating entity_names set_fact: entity_names: - "l3_vni_fabric" @@ -168,7 +168,7 @@ - "{{ ansible_sno_2 }}~{{ intf_1_3 }}~{{ ansible_sno_1 }}~{{ intf_1_3 }}" - "mmudigon-2" - - name: Query Resources - filter by entity name + - name: SANITY- Query Resources - filter by entity name cisco.dcnm.dcnm_resource_manager: state: query # choose form [merged, deleted, query] fabric: "{{ ansible_it_fabric }}" @@ -198,7 +198,7 @@ always: - - name: Delete Resources + - name: SANITY- Delete Resources cisco.dcnm.dcnm_resource_manager: *rm_delete register: result when: IT_CONTEXT is not defined From 8cc3e84001600526e0b803c20e91658917f527db Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 11:00:13 +0530 Subject: [PATCH 213/248] Update sanity.yaml --- .../dcnm_service_node/tests/dcnm/sanity.yaml | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) 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 5256dbf9a..cfd44feb2 100644 --- a/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yaml @@ -14,7 +14,7 @@ when: controller_version >= "12" tags: sanity -- name: REPLACED - Verify if fabric is deployed. +- name: SANITY- REPLACED - Verify if fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" @@ -26,7 +26,7 @@ - 'result.response.DATA != None' tags: sanity -- name: REPLACED - Verify if service fabric is deployed. +- name: SANITY- REPLACED - Verify if service fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_ext_path }}" @@ -38,14 +38,14 @@ - 'result.response.DATA != None' tags: sanity -- name: REPLACED - Clean up any existing service node +- 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 -- name: REPLACED - Query fabric state before proceeding +- name: SANITY- REPLACED - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -63,7 +63,7 @@ ### REPLACED ## ############################################### -- name: REPLACED - Create Service Node with single switch +- name: SANITY- REPLACED - Create Service Node with single switch cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -93,12 +93,12 @@ - 'result.response[0].DATA.name == "SN-11"' tags: sanity -- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state +- name: SANITY- REPLACED - sleep for 20 seconds for DCNM to completely update the state wait_for: timeout: 20 tags: sanity -- name: REPLACED - Replace Service Node with form factor physical +- name: SANITY- REPLACED - Replace Service Node with form factor physical cisco.dcnm.dcnm_service_node: &conf2 fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -127,12 +127,12 @@ - '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 +- name: SANITY- REPLACED - sleep for 20 seconds for DCNM to completely update the state wait_for: timeout: 20 tags: sanity -- name: REPLACED - conf2 - Idempotence +- name: SANITY- REPLACED - conf2 - Idempotence cisco.dcnm.dcnm_service_node: *conf2 register: result tags: sanity @@ -142,7 +142,7 @@ - 'result.changed == false' tags: sanity -- name: REPLACED - Replace Service Node with type load balancer +- name: SANITY- REPLACED - Replace Service Node with type load balancer cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -172,12 +172,12 @@ - 'result.response[0].DATA.name == "SN-11"' tags: sanity -- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state +- name: SANITY- REPLACED - sleep for 20 seconds for DCNM to completely update the state wait_for: timeout: 20 tags: sanity -- name: REPLACED - Replace Service Node with type virtual network function +- name: SANITY- REPLACED - Replace Service Node with type virtual network function cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -207,12 +207,12 @@ - 'result.response[0].DATA.name == "SN-11"' tags: sanity -- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state +- name: SANITY- REPLACED - sleep for 20 seconds for DCNM to completely update the state wait_for: timeout: 20 tags: sanity -- name: REPLACED - Replace Service Node with a new creation of service node, since the sn is not created already +- name: SANITY- REPLACED - Replace Service Node with a new creation of service node, since the sn is not created already cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -242,14 +242,14 @@ - 'result.response[0].DATA.type == "Firewall"' - 'result.response[0].DATA.name == "SN-11111111111"' -- name: REPLACED - Clean up any existing service node +- 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 -- name: REPLACED - Query fabric state before proceeding +- name: SANITY- REPLACED - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -266,7 +266,7 @@ ### OVERRIDDEN ## ############################################### -- name: OVERRIDDEN - Create 2 Service Nodes +- name: SANITY- OVERRIDDEN - Create 2 Service Nodes cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -312,12 +312,12 @@ - 'result.response[1].DATA.name == "SN-12"' tags: sanity -- name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state +- name: SANITY- OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state wait_for: timeout: 20 tags: sanity -- name: OVERRIDDEN - Create and Delete new service nodes +- name: SANITY- OVERRIDDEN - Create and Delete new service nodes cisco.dcnm.dcnm_service_node: &conf1 fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -367,12 +367,12 @@ - 'result.response[3].DATA.name == "SN-14"' tags: sanity -- name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state +- name: SANITY- OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state wait_for: timeout: 20 tags: sanity -- name: OVERRIDDEN - conf1 - Idempotence +- name: SANITY- OVERRIDDEN - conf1 - Idempotence cisco.dcnm.dcnm_service_node: *conf1 register: result tags: sanity @@ -383,14 +383,14 @@ - 'result.response|length == 0' tags: sanity -- name: OVERRIDDEN - Clean up any existing service node +- name: SANITY- OVERRIDDEN - Clean up any existing service node cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" state: deleted tags: sanity -- name: OVERRIDDEN - Query fabric state before proceeding +- name: SANITY- OVERRIDDEN - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -407,7 +407,7 @@ ### QUERY ## ############################################### -- name: QUERY - Create Service Node with single switch +- name: SANITY- QUERY - Create Service Node with single switch cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -437,12 +437,12 @@ - 'result.response[0].DATA.name == "SN-11"' tags: sanity -- name: QUERY - sleep for 20 seconds for DCNM to completely update the state +- name: SANITY- QUERY - sleep for 20 seconds for DCNM to completely update the state wait_for: timeout: 20 tags: sanity -- name: QUERY - Query the - Create Service Node with single switch +- name: SANITY- QUERY - Query the - Create Service Node with single switch cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -471,7 +471,7 @@ - 'result.response[0].name == "SN-11"' tags: sanity -- name: QUERY - Query without the config element +- name: SANITY- QUERY - Query without the config element cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -491,14 +491,14 @@ - 'result.response[0].name == "SN-11"' tags: sanity -- name: QUERY - Clean up any existing service node +- name: SANITY- QUERY - Clean up any existing service node cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" state: deleted tags: sanity -- name: QUERY - Query fabric state before proceeding +- name: SANITY- QUERY - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" From 7d5ddbb07edd01f877055ddc24b5ead4dc1dbbb8 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 11:05:28 +0530 Subject: [PATCH 214/248] Update sanity.yml --- .../dcnm_service_policy/tests/dcnm/sanity.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml b/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml index e172a2acb..5c2f742a6 100644 --- a/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml +++ b/tests/integration/targets/dcnm_service_policy/tests/dcnm/sanity.yml @@ -2,11 +2,11 @@ ## SETUP ## ############################################## -- name: Remove local log file +- name: SANITY- Remove local log file local_action: command rm -f sp.log #tags: sanity -- name: Delete service policies +- name: SANITY- Delete service policies cisco.dcnm.dcnm_service_policy: &dcnm_sp_del_all fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory @@ -42,7 +42,7 @@ ## MERGE ## ############################################## - - name: Create service policy including all optional objects + - name: SANITY- Create service policy including all optional objects cisco.dcnm.dcnm_service_policy: &dcnm_sp_create_all fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory @@ -160,7 +160,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 5' - - name: Query service policies based on service node and policy name + - name: SANITY- Query service policies based on service node and policy name cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory @@ -198,7 +198,7 @@ ## OVERRRIDE ## ############################################## - - name: Override and delete all service policies without any new one + - name: SANITY- Override and delete all service policies without any new one cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory @@ -223,7 +223,7 @@ ## MERGE ## ############################################## - - name: Create service policy including all optional objects + - name: SANITY- Create service policy including all optional objects cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory @@ -287,7 +287,7 @@ ## REPLACE ## ############################################## - - name: Replace some of the objects in already created policy + - name: SANITY- Replace some of the objects in already created policy cisco.dcnm.dcnm_service_policy: &dcnm_sp_replace_all fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory @@ -346,7 +346,7 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - name: Replace service policies - Idempotence + - name: SANITY- Replace service policies - Idempotence cisco.dcnm.dcnm_service_policy: *dcnm_sp_replace_all register: result @@ -365,7 +365,7 @@ always: - - name: Delete service policies + - name: SANITY- Delete service policies cisco.dcnm.dcnm_service_policy: *dcnm_sp_del_all register: result when: IT_CONTEXT is not defined From 38347756662aa780912a5a7a96cfdcf3743afdf3 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 11:06:18 +0530 Subject: [PATCH 215/248] Update sanity.yaml --- .../dcnm_service_route_peering/tests/dcnm/sanity.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/sanity.yaml index 05c90f53e..caedfcd63 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/sanity.yaml @@ -2,11 +2,11 @@ ## SETUP ## ############################################## -- name: Remove local log file +- name: SANITY- Remove local log file local_action: command rm -f srp.log tags: sanity -- name: Delete route peerings +- name: SANITY- Delete route peerings cisco.dcnm.dcnm_service_route_peering: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_it_service_fabric }}" @@ -28,7 +28,7 @@ ## MERGE ## ############################################## - - name: Create different non-existing service route peerings including all objects + - name: SANITY- Create different non-existing service route peerings including all objects cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_it_service_fabric }}" @@ -275,7 +275,7 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - name: Create service route peerings - Idempotence + - name: SANITY- Create service route peerings - Idempotence cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_all register: result @@ -295,7 +295,7 @@ always: - - name: Delete all created route peerings + - name: SANITY- Delete all created route peerings cisco.dcnm.dcnm_service_route_peering: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_it_service_fabric }}" From 6584426f53a0116faaf10af24bdba7c67c486da7 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 11:07:39 +0530 Subject: [PATCH 216/248] Update sanity.yaml --- .../dcnm_template/tests/dcnm/sanity.yaml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml index 09b6fbf2b..10988605c 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/sanity.yaml @@ -2,7 +2,7 @@ ## SETUP ## ############################################## -- name: Initialize the setup +- name: SANITY- Initialize the setup cisco.dcnm.dcnm_template: state: deleted # only choose form [merged, deleted, query] config: @@ -26,7 +26,7 @@ ## MERGE ## ############################################## - - name: Create templates + - name: SANITY- Create templates cisco.dcnm.dcnm_template: &temp_merge state: merged # only choose form [merged, deleted, query] config: @@ -128,7 +128,7 @@ ############################################## - - name: Modifying existing templates + - name: SANITY- Modifying existing templates cisco.dcnm.dcnm_template: &temp_repl state: merged # only choose form [merged, deleted, query] config: @@ -231,7 +231,7 @@ ## CLEANUP ## ############################################## - - name: Initialize the setup + - name: SANITY- Initialize the setup cisco.dcnm.dcnm_template: state: deleted # only choose form [merged, deleted, query] config: @@ -244,7 +244,7 @@ ## NO DELETE ## ############################################## - - name: Create a template + - name: SANITY- Create a template cisco.dcnm.dcnm_template: &temp_merge2 state: merged # only choose form [merged, deleted, query] config: @@ -280,7 +280,7 @@ - '"Template Created" in item["DATA"]["status"]' loop: '{{ result.response }}' - - name: Delete templates along with the template which is already installed on a switch + - name: SANITY- 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] config: @@ -300,7 +300,7 @@ - '"template_inuse_2" in result["template-policy-map"].keys()' loop: '{{ result.response }}' - - name: Delete a template which is not existing + - name: SANITY- Delete a template which is not existing cisco.dcnm.dcnm_template: state: deleted # only choose form [merged, deleted, query] config: @@ -317,7 +317,7 @@ ## QUERY ## ############################################## - - name: Query a template + - name: SANITY- Query a template cisco.dcnm.dcnm_template: state: query # only choose form [merged, deleted, query] config: @@ -345,7 +345,7 @@ ## TEMPLATE VALIDATION FAIL ## ############################################## - - name: Create templates + - name: SANITY- Create templates cisco.dcnm.dcnm_template: &temp_merge3 state: merged # only choose form [merged, deleted, query] config: @@ -376,7 +376,7 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - - name: set_fact when error found + - name: SANITY- set_fact when error found set_fact: error_exists: true loop: "{{ lookup('list', result['response'][0]['DATA']) }}" @@ -391,7 +391,7 @@ ############################################## - - name: Create templates + - name: SANITY- Create templates cisco.dcnm.dcnm_template: &temp_merge4 state: replaced # only choose form [merged, deleted, query] config: @@ -425,7 +425,7 @@ ############################################## - - name: Delete all templates created + - name: SANITY- Delete all templates created cisco.dcnm.dcnm_template: &temp_delete state: deleted # only choose form [merged, deleted, query] config: From 5b66c37a0f5b93ae954f4a98b52d6bf6fbe02e4b Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 11:12:13 +0530 Subject: [PATCH 217/248] Update sanity.yaml --- .../targets/dcnm_vrf/tests/dcnm/sanity.yaml | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml index c77c2b1e8..46def14db 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml @@ -14,7 +14,7 @@ tags: - sanity -- name: MERGED - Verify if fabric is deployed. +- name: SANITY- MERGED - Verify if fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" @@ -26,13 +26,13 @@ - 'result.response.DATA != None' tags: sanity -- name: MERGED - Clean up any existing vrfs +- name: SANITY- MERGED - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: deleted tags: sanity -- name: Pause for 20 seconds for NDFC to sync +- name: SANITY- Pause for 20 seconds for NDFC to sync ansible.builtin.pause: seconds: 20 tags: sanity @@ -41,7 +41,7 @@ ### MERGED ## ############################################### -- name: MERGED - Create, Attach and Deploy new VRF - VLAN Provided by the User +- name: SANITY- MERGED - Create, Attach and Deploy new VRF - VLAN Provided by the User cisco.dcnm.dcnm_vrf: &conf fabric: "{{ test_fabric }}" state: merged @@ -58,7 +58,7 @@ register: result tags: sanity -- name: Query fabric state until vrfStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: query @@ -84,7 +84,7 @@ - 'result.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity -- name: MERGED - conf1 - Idempotence +- name: SANITY- MERGED - conf1 - Idempotence cisco.dcnm.dcnm_vrf: *conf register: result tags: sanity @@ -95,13 +95,13 @@ - 'result.response|length == 0' tags: sanity -- name: MERGED - Clean up any existing vrfs +- name: SANITY- MERGED - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: deleted tags: sanity -- name: Pause for 20 seconds for NDFC to sync +- name: SANITY- Pause for 20 seconds for NDFC to sync ansible.builtin.pause: seconds: 20 tags: sanity @@ -110,7 +110,7 @@ ### REPLACED ## ############################################### -- name: REPLACED - Create, Attach and Deploy new VRF - VLAN Provided by the User +- name: SANITY- REPLACED - Create, Attach and Deploy new VRF - VLAN Provided by the User cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: merged @@ -127,7 +127,7 @@ register: result tags: sanity -- name: Query fabric state until vrfStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: query @@ -151,7 +151,7 @@ - 'result.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity -- name: REPLACED - Update existing VRF using replace - delete attachments +- name: SANITY- REPLACED - Update existing VRF using replace - delete attachments cisco.dcnm.dcnm_vrf: &conf1 fabric: "{{ test_fabric }}" state: replaced @@ -164,7 +164,7 @@ register: result tags: sanity -- name: Query fabric state until vrfStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: query @@ -187,7 +187,7 @@ - 'result.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity -- name: REPLACED - conf1 - Idempotence +- name: SANITY- REPLACED - conf1 - Idempotence cisco.dcnm.dcnm_vrf: *conf1 register: result tags: sanity @@ -197,7 +197,7 @@ - 'result.changed == false' tags: sanity -- name: REPLACED - Update existing VRF using replace - create attachments +- name: SANITY- REPLACED - Update existing VRF using replace - create attachments cisco.dcnm.dcnm_vrf: &conf2 fabric: "{{ test_fabric }}" state: replaced @@ -214,7 +214,7 @@ register: result tags: sanity -- name: Query fabric state until vrfStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: query @@ -239,7 +239,7 @@ - 'result.diff[0].attach[1].vlan_id == 500' tags: sanity -- name: REPLACED - conf2 - Idempotence +- name: SANITY- REPLACED - conf2 - Idempotence cisco.dcnm.dcnm_vrf: *conf2 register: result tags: sanity @@ -249,13 +249,13 @@ - 'result.changed == false' tags: sanity -- name: REPLACED - Clean up any existing vrfs +- name: SANITY- REPLACED - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: deleted tags: sanity -- name: Pause for 20 seconds for NDFC to sync +- name: SANITY- Pause for 20 seconds for NDFC to sync ansible.builtin.pause: seconds: 20 tags: sanity @@ -264,7 +264,7 @@ ### OVERRIDDEN ## ############################################### -- name: OVERRIDDEN - Create, Attach and Deploy new VRF - VLAN Provided by the User +- name: SANITY- OVERRIDDEN - Create, Attach and Deploy new VRF - VLAN Provided by the User cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: merged @@ -281,7 +281,7 @@ register: result tags: sanity -- name: Query fabric state until vrfStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: query @@ -307,7 +307,7 @@ - 'result.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity -- name: OVERRIDDEN - Update existing VRF using overridden - delete and create +- name: SANITY- OVERRIDDEN - Update existing VRF using overridden - delete and create cisco.dcnm.dcnm_vrf: &conf3 fabric: "{{ test_fabric }}" state: overridden @@ -324,7 +324,7 @@ register: result tags: sanity -- name: Query fabric state until vrfStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: query @@ -356,7 +356,7 @@ - 'result.diff[1].vrf_name == "ansible-vrf-int1"' tags: sanity -- name: OVERRIDDEN - conf - Idempotence +- name: SANITY- OVERRIDDEN - conf - Idempotence cisco.dcnm.dcnm_vrf: *conf3 register: result tags: sanity @@ -367,13 +367,13 @@ - 'result.response|length == 0' tags: sanity -- name: OVERRIDDEN - Clean up any existing vrfs +- name: SANITY- OVERRIDDEN - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: deleted tags: sanity -- name: Pause for 20 seconds for NDFC to sync +- name: SANITY- Pause for 20 seconds for NDFC to sync ansible.builtin.pause: seconds: 20 tags: sanity @@ -382,7 +382,7 @@ ### QUERY ## ############################################### -- name: QUERY - Create, Attach and Deploy new VRF - VLAN Provided by the User +- name: SANITY- QUERY - Create, Attach and Deploy new VRF - VLAN Provided by the User cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: merged @@ -399,7 +399,7 @@ register: result tags: sanity -- name: Query fabric state until vrfStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: query @@ -425,7 +425,7 @@ - 'result.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity -- name: QUERY - Query the VRF +- name: SANITY- QUERY - Query the VRF cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: query @@ -456,14 +456,14 @@ - 'result.response[0].attach[1].switchDetailsList[0].vlan == 500' tags: sanity -- name: QUERY - Clean up existing vrfs +- name: SANITY- QUERY - Clean up existing vrfs cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: deleted register: result tags: sanity -- name: Pause for 20 seconds for NDFC to sync +- name: SANITY- Pause for 20 seconds for NDFC to sync ansible.builtin.pause: seconds: 20 tags: sanity @@ -472,7 +472,7 @@ ### DELETED ## ############################################### -- name: DELETED - Create, Attach and Deploy new VRF - VLAN Provided by the User +- name: SANITY- DELETED - Create, Attach and Deploy new VRF - VLAN Provided by the User cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: merged @@ -489,7 +489,7 @@ register: result tags: sanity -- name: Query fabric state until vrfStatus transitions to DEPLOYED state +- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: fabric: "{{ test_fabric }}" state: query @@ -515,7 +515,7 @@ - 'result.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity -- name: DELETED - Delete VRF using deleted state +- name: SANITY- DELETED - Delete VRF using deleted state cisco.dcnm.dcnm_vrf: &conf4 fabric: "{{ test_fabric }}" state: deleted @@ -542,7 +542,7 @@ - 'result.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity -- name: DELETED - conf - Idempotence +- name: SANITY- DELETED - conf - Idempotence cisco.dcnm.dcnm_vrf: *conf4 register: result tags: sanity From 3f192ac3d4d72067635471d0ab84a240a4dad0aa Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 12:50:38 +0530 Subject: [PATCH 218/248] Update dcnm_network.py --- plugins/modules/dcnm_network.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/modules/dcnm_network.py b/plugins/modules/dcnm_network.py index afc4a1ad4..2f8fe86f6 100644 --- a/plugins/modules/dcnm_network.py +++ b/plugins/modules/dcnm_network.py @@ -4,6 +4,7 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at +# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software From 47dd5ef1c378d86edc5ebf272c7d4e10a2d35301 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:00:53 +0530 Subject: [PATCH 219/248] Update dcnm_network.py --- plugins/modules/dcnm_network.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/modules/dcnm_network.py b/plugins/modules/dcnm_network.py index 2f8fe86f6..4c84118a8 100644 --- a/plugins/modules/dcnm_network.py +++ b/plugins/modules/dcnm_network.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (c) 2020-2023 Cisco and/or its affiliates. # +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at From d88a670eba25c4ce68610ac037851e17fec0ee1f Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:04:31 +0530 Subject: [PATCH 220/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 78c5c2a76..5768a2506 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,6 +128,7 @@ jobs: command: | export MODULENAME="<< parameters.modulename >>" echo " - dcnm_$MODULENAME" >> dcnm_roles.yaml + cat dcnm_roles.yaml sanity-tests: parameters: From 69caa7397b8caedf9d9b50b545e4f2febd6fd7f0 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:11:48 +0530 Subject: [PATCH 221/248] Updated config.yml --- .circleci/config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5768a2506..d95147daa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,6 +70,7 @@ jobs: - run: name: Create Roles File header command: | + rm dcnm_roles.yaml echo "---" > dcnm_roles.yaml echo "- hosts: dcnm" >> dcnm_roles.yaml echo " gather_facts: no" >> dcnm_roles.yaml @@ -83,6 +84,8 @@ jobs: echo " roles:" >> dcnm_roles.yaml cat dcnm_roles.yaml + pwd + ls -l - run: name: Copy static files command: | @@ -128,6 +131,8 @@ jobs: command: | export MODULENAME="<< parameters.modulename >>" echo " - dcnm_$MODULENAME" >> dcnm_roles.yaml + pwd + ls -l cat dcnm_roles.yaml sanity-tests: From 58bf201cad497b69885b92d10ad337722ca9d25c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:17:29 +0530 Subject: [PATCH 222/248] Delete dcnm_roles.yaml --- dcnm_roles.yaml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 dcnm_roles.yaml diff --git a/dcnm_roles.yaml b/dcnm_roles.yaml deleted file mode 100644 index 143196b22..000000000 --- a/dcnm_roles.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- hosts: dcnm - gather_facts: no - connection: ansible.netcommon.httpapi - - tasks: - - vars: - debug: false - - roles: - #- dcnm_interface - #- dcnm_template - #- dcnm_resource_manager - #- dcnm_policy - #- dcnm_inventory - #- dcnm_vrf - #- dcnm_service_node - #- dcnm_network - #- dcnm_links - - dcnm_service_route_peering From cea1bcb8ba344b9431ad4278020647d2fe551369 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:17:49 +0530 Subject: [PATCH 223/248] Delete dcnm-ut --- dcnm-ut | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 dcnm-ut diff --git a/dcnm-ut b/dcnm-ut deleted file mode 100644 index e69de29bb..000000000 From 45920904a285ca47f117127e422043aef842ca01 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:18:09 +0530 Subject: [PATCH 224/248] Delete dcnm_test.yaml --- dcnm_test.yaml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 dcnm_test.yaml diff --git a/dcnm_test.yaml b/dcnm_test.yaml deleted file mode 100644 index d63a14142..000000000 --- a/dcnm_test.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- hosts: dcnm - gather_facts: no - connection: ansible.netcommon.httpapi - - tasks: - - - set_fact: - rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" - - - name: MERGED - Verify if fabric is deployed. - cisco.dcnm.dcnm_rest: - method: GET - path: "{{ rest_path }}" - register: result From d5d43488de9cf57ce8f49212707893b2d78c5d73 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:18:42 +0530 Subject: [PATCH 225/248] Delete hosts --- hosts | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 hosts diff --git a/hosts b/hosts deleted file mode 100644 index 8535ecdb2..000000000 --- a/hosts +++ /dev/null @@ -1,5 +0,0 @@ -[all:vars] -ansible_python_interpreter=/home/circleci/.pyenv/versions/python_3.9/bin/python - -[dcnm] - 10.2.1.99 From 9aeb53af59baa4c8ab9cb12383f4b284e848912b Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:19:05 +0530 Subject: [PATCH 226/248] Delete group_vars directory --- group_vars/dcnm.yaml | 140 ------------------------------------------- 1 file changed, 140 deletions(-) delete mode 100644 group_vars/dcnm.yaml diff --git a/group_vars/dcnm.yaml b/group_vars/dcnm.yaml deleted file mode 100644 index 26c9a0dc3..000000000 --- a/group_vars/dcnm.yaml +++ /dev/null @@ -1,140 +0,0 @@ ---- - -ansible_ssh_user: admin -ansible_user: admin -ansible_network_os: cisco.dcnm.dcnm -ansible_ssh_pass: ins3965! -ansible_pass: ins3965! -ansible_python_interpreter: python -ansible_httpapi_validate_certs: False -ansible_httpapi_use_ssl : True -ansible_int1 : Ethernet1/3 -ansible_int2 : Ethernet1/2 -ansible_int3 : Ethernet1/2 -intf_1_10 : Ethernet1/10 -intf_1_3 : Ethernet1/3 -intf_1_2 : Ethernet1/2 -intf_1_1 : Ethernet1/1 -intf_1_4 : Ethernet1/4 -intf_1_5 : Ethernet1/5 -ansible_sw1_int1 : Ethernet1/24 -ansible_sw1_int2 : Ethernet1/26 -ansible_sw2_int1 : Ethernet1/24 -ansible_sw2_int2 : Ethernet1/26 -ansible_sw1_int3 : Ethernet1/24 -ansible_sw1_int4 : Ethernet1/25 -ansible_sw2_int3 : Ethernet1/24 -ansible_sw2_int4 : Ethernet1/26 -ansible_sw2_int5 : Ethernet1/24 -ansible_sw2_int6 : Ethernet1/26 -ansible_it_fabric : test_fabric -ansible_ext_fabric : test_ext_fabric -ansible_it_service_fabric : test_ext_fabric -ansible_svi_fabric : test_fabric -test_fabric: test_fabric -ansible_num_fabric: test_fabric -ansible_switch1 : 10.2.5.10 -ansible_switch2 : 10.2.5.11 -ansible_sno_1 : 9QCOXEMR23F -ansible_sno_2 : 94ISY0RAPF9 -ansible_num_switch1 : 10.2.5.10 -ansible_num_switch2 : 10.2.5.11 -switch_username: admin -switch_password: ins3965! -ansible_vpc1: vPC2 -ansible_vpc2: vPC1 -ansible_poap_switch : 192.168.123.223 -ansible_poap_serial : "9D2DAUJJFQQ" -ansible_poap_model : "N9K-C9300v" -ansible_poap_swversion : "9.3(7)" -ansible_poap_hostname : "test_poap_test" -ansible_poap_config_data : '{"modulesModel": ["N9K-C9300v"], "gateway": "192.168.123.1/24"}' -ansible_prepro_switch : 192.168.123.224 -ansible_prepro_serial : "9D2DAUJJFRR" -ansible_prepro_model : "N9K-C9300v" -ansible_prepro_swversion : "9.3(7)" -ansible_prepro_hostname : "test_poap_prepro" -ansible_modules_model: ["N9K-C9300v"] -ansible_bstrap_gateway: 192.168.123.1/24 -ansible_prepro_config_data : '{modulesModel: ["N9K-C9300v"], gateway: 192.168.123.1/24}' -ansible_rma_serial: "9D2DAUJJFQQ" -ansible_switch1_serial: "944XJW7L3YJ" -ansible_rma_model : "N9K-C9300v" -ansible_rma_swversion : "9.3(7)" -ansible_rma_hostname : "test_poap_test" -ansible_rma_modules: ["N9K-C9300v"] -test_ing_fabric: test_poap -ansible_ing_switch1: 192.168.123.219 -ansible_ing_sw1_int1 : Ethernet1/24 -ansible_ing_sw1_int2 : Ethernet1/26 - -# All physical interfaces are defined as variables here. Make sure for running VPC interfaces -# the following interfaces are not part of VPC link -ansible_eth_intf1: eth1/16 -ansible_sub_intf1: eth1/16.10 -ansible_eth_intf2: eth1/20 -ansible_eth_intf3: eth1/21 -ansible_eth_intf4: eth1/22 -ansible_eth_intf5: eth1/23 -ansible_eth_intf6: eth1/24 -ansible_eth_intf7: eth1/30 -ansible_eth_intf8: eth1/31 -ansible_eth_intf9: eth1/32 -ansible_eth_intf10: eth1/33 -ansible_eth_intf11: eth1/34 -ansible_eth_intf12: eth1/40 -ansible_sub_intf4: eth1/19.10 -ansible_sub_intf5: eth1/19.20 -ansible_sub_intf2: eth1/16.20 -ansible_sub_intf3: eth1/16.30 -ansible_eth_intf13: eth1/10 -ansible_eth_intf14: eth1/11 -ansible_eth_intf15: eth1/12 -ansible_eth_intf16: eth1/13 -ansible_eth_intf17: eth1/14 -ansible_eth_intf18: eth1/15 -# Changed this last - eth1/15 to eth1/18 -ansible_eth_intf19: eth1/18 -ansible_eth_intf20: eth1/17 -ansible_eth_intf21: eth1/25 -ansible_eth_intf22: eth1/26 -ansible_eth_intf23: eth1/28 -ansible_eth_intf24: eth1/27 - -# VRFs for Service Route Peering - -ansible_vrf_11 : MY_IT_VRF_11 -ansible_vrf_12 : MY_IT_VRF_12 -ansible_vrf_21 : MY_IT_VRF_21 -ansible_vrf_22 : MY_IT_VRF_22 -ansible_vrf_31 : MY_IT_VRF_31 -ansible_vrf_32 : MY_IT_VRF_32 -ansible_vrf_41 : MY_IT_VRF_41 -ansible_vrf_42 : MY_IT_VRF_42 -ansible_vrf_51 : MY_IT_VRF_51 -ansible_vrf_52 : MY_IT_VRF_52 -ansible_vrf_61 : MY_IT_VRF_61 -ansible_vrf_62 : MY_IT_VRF_62 -ansible_vrf_71 : MY_IT_VRF_71 -ansible_vrf_72 : MY_IT_VRF_72 -ansible_vrf_81 : MY_IT_VRF_81 -ansible_vrf_82 : MY_IT_VRF_82 - -# Service Nodes for Service Route Peering - -ansible_snode_1 : IT-SN-1 -ansible_snode_2 : IT-SN-2 -ansible_snode_3 : IT-SN-3 - -ansible_fw_rp1: IT-FW-RP1 -ansible_fw_rp2: IT-FW-RP2 -ansible_fw_rp3: IT-FW-RP3 -ansible_adc_rp4: IT-ADC-RP4 -ansible_adc_rp5: IT-ADC-RP5 -ansible_adc_rp6: IT-ADC-RP6 -ansible_adc_rp7: IT-ADC-RP7 -ansible_adc_rp8: IT-VNF-RP8 - -ansible_att_intf1 : Ethernet1/2 -ansible_att_intf2 : Ethernet1/3 -ansible_att_intf3 : Ethernet1/4 From 483ad831467c77b3917ae2e44752d7fa257aff82 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:21:16 +0530 Subject: [PATCH 227/248] Updated config.yml --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d95147daa..d6a630caf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,7 +70,6 @@ jobs: - run: name: Create Roles File header command: | - rm dcnm_roles.yaml echo "---" > dcnm_roles.yaml echo "- hosts: dcnm" >> dcnm_roles.yaml echo " gather_facts: no" >> dcnm_roles.yaml From 084758dd817794e89413d170f454d4d477acc6c9 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 14:36:35 +0530 Subject: [PATCH 228/248] Update dcnm_network.py --- plugins/modules/dcnm_network.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/modules/dcnm_network.py b/plugins/modules/dcnm_network.py index 4c84118a8..70d5e563b 100644 --- a/plugins/modules/dcnm_network.py +++ b/plugins/modules/dcnm_network.py @@ -1,7 +1,5 @@ #!/usr/bin/python # Copyright (c) 2020-2023 Cisco and/or its affiliates. -# -# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at From 47c50bb4b53ea8ea1e9e722fa3e5b277e09e1f63 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Wed, 19 Jul 2023 15:06:33 +0530 Subject: [PATCH 229/248] Update sanity.yaml --- tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml index 9ab8bc7a8..552916e8d 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml @@ -256,7 +256,7 @@ ############################################## - name: SANITY- REPLACED - Update Network using replace - Delete Attachments - cisco.dcnm.dcnm_network: &conf1 + cisco.dcnm.dcnm_network: &conf2 fabric: "{{ test_fabric }}" state: replaced config: @@ -309,7 +309,7 @@ tags: sanity - name: SANITY- REPLACED - conf1 - Idempotence - cisco.dcnm.dcnm_network: *conf1 + cisco.dcnm.dcnm_network: *conf2 register: result tags: sanity From 74cf71c8640957fdf0aca2e03914e322b39036b9 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani Date: Wed, 19 Jul 2023 05:36:03 -0700 Subject: [PATCH 230/248] Network sanity update --- .../targets/dcnm_network/tasks/dcnm.yaml | 10 +++++-- .../targets/dcnm_network/tasks/main.yaml | 11 ++++---- .../dcnm_network/tests/dcnm/sanity.yaml | 26 ++++++++++++------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/tests/integration/targets/dcnm_network/tasks/dcnm.yaml b/tests/integration/targets/dcnm_network/tasks/dcnm.yaml index a13eb3a0b..8a842e5c1 100644 --- a/tests/integration/targets/dcnm_network/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_network/tasks/dcnm.yaml @@ -10,7 +10,7 @@ - set_fact: test_cases: files: "{{ dcnm_cases.files }}" - tags: sanity + tags: sanity - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" @@ -21,4 +21,10 @@ with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - tags: sanity + tags: sanity + +- name: DELETED - Clean up any existing vrfs + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_fabric }}" + state: deleted + tags: sanity diff --git a/tests/integration/targets/dcnm_network/tasks/main.yaml b/tests/integration/targets/dcnm_network/tasks/main.yaml index c27294d0e..79e7249f8 100644 --- a/tests/integration/targets/dcnm_network/tasks/main.yaml +++ b/tests/integration/targets/dcnm_network/tasks/main.yaml @@ -2,7 +2,7 @@ - set_fact: controller_version: "Unable to determine controller version" - tags: sanity + tags: sanity - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: @@ -36,13 +36,13 @@ - assert: that: - 'controller_version != "Unable to determine controller version"' - tags: sanity + tags: sanity - name: Remove all existing networks to start with a clean state cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: deleted - tags: sanity + tags: sanity - name: Create vrfs required for this test and remove all other vrfs cisco.dcnm.dcnm_vrf: @@ -70,6 +70,7 @@ - ip_address: "{{ ansible_switch1 }}" - ip_address: "{{ ansible_switch2 }}" deploy: true - tags: sanity + tags: sanity -- { include_tasks: dcnm.yaml, tags: ['dcnm'] } +- { include: dcnm.yaml, tags: ['dcnm'] } +#- { include_tasks: dcnm.yaml, tags: ['dcnm'] } diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml index 552916e8d..223a40efe 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml @@ -28,7 +28,7 @@ cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: deleted - tags: sanity + tags: sanity - name: SANITY- MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach cisco.dcnm.dcnm_network: @@ -95,7 +95,7 @@ - 'result.diff[1].net_name == "ansible-net12"' - 'result.diff[1].net_id == 7002' - 'result.diff[1].vrf_name == "Tenant-2"' - tags: sanity + tags: sanity ############################################## ## OVERRIDDEN ## @@ -161,15 +161,17 @@ - '"{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address' - 'result.diff[1].net_name == "ansible-net12"' tags: sanity + - name: OVERRIDDEN - conf1 - Idempotence cisco.dcnm.dcnm_network: *conf1 register: result + tags: sanity - assert: that: - 'result.changed == false' - 'result.response|length == 0' - tags: sanity + tags: sanity - name: SANITY- OVERRIDDEN - setup - remove any networks cisco.dcnm.dcnm_network: @@ -182,7 +184,7 @@ cisco.dcnm.dcnm_network: fabric: "{{ test_fabric }}" state: deleted - tags: sanity + tags: sanity - name: SANITY- REPLACED - Create, Attach and Deploy Multiple Network with Single Switch Attach cisco.dcnm.dcnm_network: @@ -249,7 +251,7 @@ - 'result.diff[1].net_name == "ansible-net12"' - 'result.diff[1].net_id == 7002' - 'result.diff[1].vrf_name == "Tenant-2"' - tags: sanity + tags: sanity ############################################## ## REPLACED ## @@ -299,16 +301,16 @@ - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' - '(result.response[0].DATA|dict2items)[2].value == "SUCCESS"' - 'result.diff[0].attach[0].deploy == false' - - 'result.diff[0].attach[1].deploy == false' - '"{{ ansible_switch1 }}" or "{{ ansible_switch2 }}" in result.diff[1].attach[0].ip_address' - '"{{ ansible_switch2 }}" or "{{ ansible_switch1 }}" in result.diff[1].attach[1].ip_address' - '"ansible-net13" or "ansible-net12" in result.diff[1].net_name' + - 'result.diff[1].attach[1].deploy == false' - 'result.diff[1].attach[0].deploy == false' - '"{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address' - '"ansible-net13" or "ansible-net12" in result.diff[0].net_name' - tags: sanity + tags: sanity -- name: SANITY- REPLACED - conf1 - Idempotence +- name: SANITY - REPLACED - conf1 - Idempotence cisco.dcnm.dcnm_network: *conf2 register: result tags: sanity @@ -317,4 +319,10 @@ that: - 'result.changed == false' - 'result.response|length == 0' - tags: sanity + tags: sanity + +- name: SANITY - DELETED - setup - Clean up any existing networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_fabric }}" + state: deleted + tags: sanity From 1d8fea13ded623c52dd0ad62ee2aac991709307c Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 15:34:58 +0530 Subject: [PATCH 231/248] Create releaseinfo.yaml --- releaseinfo.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 releaseinfo.yaml diff --git a/releaseinfo.yaml b/releaseinfo.yaml new file mode 100644 index 000000000..c9f099e71 --- /dev/null +++ b/releaseinfo.yaml @@ -0,0 +1,14 @@ +version: "1.2.3" +release_title: "Ansible ndfc 1.2.3" +release_desc: "Cisco Ansible DCNM Collection" +changes: + added: + - "Support to configure muliple interfaces for vrf_lite on a vrf" + - "Added support for more switch roles in inventory module." + + fixed: + - "https://github.com/CiscoDevNet/ansible-dcnm/issues/204" + - "https://github.com/CiscoDevNet/ansible-dcnm/issues/205" + - "https://github.com/CiscoDevNet/ansible-dcnm/issues/206" + - "Removed the restriction on netcommon version supported by DCNM collection. The restriction was introduced as fix for CiscoDevNet#209. Netcommon versions >=2.6.1 is supported." + From bc5ee5691ea2d6f0099cc775adca2afe004dbcd7 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 17:13:57 +0530 Subject: [PATCH 232/248] Update releaseinfo.yaml --- releaseinfo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/releaseinfo.yaml b/releaseinfo.yaml index c9f099e71..d263f65b0 100644 --- a/releaseinfo.yaml +++ b/releaseinfo.yaml @@ -1,5 +1,5 @@ -version: "1.2.3" -release_title: "Ansible ndfc 1.2.3" +version: "1.2.8" +release_title: "Ansible ndfc 1.2.8" release_desc: "Cisco Ansible DCNM Collection" changes: added: From cab8eb3883e81c925a3a5f1fae3b79309ab00171 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 17:15:44 +0530 Subject: [PATCH 233/248] Updated config.yml --- .circleci/config.yml | 67 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d6a630caf..376c7f606 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,7 +52,9 @@ parameters: run-any: type: boolean default: false - + run-prep-release: + type: boolean + default: false jobs: build: @@ -247,6 +249,55 @@ jobs: coverage run --source=. -m pytest tests/unit/modules/dcnm/. -vvvv + update-files: + + working_directory: ~/repo + machine: true + resource_class: cisco/ansible-dcnm + steps: + - checkout + - run: + name: Update galaxy.yml, CHANGELOG.md and README.md files + command: | + python3 /home/circleci/static/releaseparser.py + + - run: + name: Create new branch and raise PR against main + command: | + source temp.txt + git checkout -b $COLLECTION_VERSION + git add CHANGELOG.md + git add README.md + git add galaxy.yml + git status + echo "=======" + git commit -m "Released new version: $COLLECTION_VERSION" + git status + git push -u origin $COLLECTION_VERSION + gh pr create --base main --head $COLLECTION_VERSION --title "Release $COLLECTION_VERSION" --body "Release $COLLECTION_VERSION" + + tag-release: + + working_directory: ~/repo + machine: true + resource_class: cisco/ansible-dcnm + steps: + - checkout + - run: + name: Create Tag and Release on gh and then publish to ansible-galaxy + command: | + source temp.txt + git checkout main + git tag -a $COLLECTION_VERSION -m "Ansible NDFC Collection Version $COLLECTION_VERSION" + git push origin --tags + gh release create v1.2.3 -F CHANGELOG.md + ansible-galaxy collection build + mkdir ./tmp/ + ansible-galaxy collection install cisco-dcnm-$COLLECTION_VERSION.tar.gz -p ./tmp/ + ansible-galaxy collection publish ./cisco-dcnm-3.3.1.tar.gz --api-key + rm temp.txt + + workflows: pre: when: << pipeline.parameters.run-setup >> @@ -292,6 +343,7 @@ workflows: plugins/modules/dcnm_template.py run-template true plugins/modules/dcnm_vrf.py run-vrf true + releaseinfo.yaml run-prep-release true tests/unit/modules/dcnm run-all-unit true tests/integration/targets/dcnm_inventory/.* run-inventory true @@ -357,7 +409,6 @@ workflows: - << pipeline.parameters.run-links >> jobs: - addrole: - matrix: parameters: modulename: @@ -497,4 +548,14 @@ workflows: # - 2.13.8 - 2.13.6 - + prep-release: + when: << pipeline.parameters.run-prep-release >> + jobs: + - update-files: + filters: + branches: + only: develop + - tag-release: + type: approval + requires: + - update-files From 7b54a7344956c4eec49e3171ad37e65d26cb64b6 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 17:20:20 +0530 Subject: [PATCH 234/248] Updated config.yml --- .circleci/config.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 376c7f606..5e876d276 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -368,6 +368,19 @@ workflows: # module-a/.* run-module-a true # module-b/.* run-module-b true + - path-filtering/filter: + filters: + branches: + only: develop + requires: + - build + # Compare files on develop + base-revision: main + # Config for continuation; herein we reuse this config itself + config-path: .circleci/config.yml + # 3-column space-separated table for mapping; `path-to-test parameter-to-set value-for-parameter` for each row + mapping: | + releaseinfo.yaml run-prep-release true all-unit: when: From 015aa5982d6f420bb6a565a1de85998d432a1d7a Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 17:23:42 +0530 Subject: [PATCH 235/248] Updated config.yml --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5e876d276..4cd99dbe4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -380,6 +380,7 @@ workflows: config-path: .circleci/config.yml # 3-column space-separated table for mapping; `path-to-test parameter-to-set value-for-parameter` for each row mapping: | + .* run-setup false releaseinfo.yaml run-prep-release true all-unit: From ccc20f045696a40f4c4d8f317c6dff476acb7a69 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 17:28:46 +0530 Subject: [PATCH 236/248] Updated config.yml --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4cd99dbe4..718ecb046 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -315,6 +315,9 @@ workflows: - 2.13.6 - path-filtering/filter: + filters: + branches: + ignore: develop requires: - build # Compare files on develop From c378987fd431d4584cd80a81bfad897e8026475d Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 17:30:58 +0530 Subject: [PATCH 237/248] Updated config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 718ecb046..c0202d020 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -273,7 +273,7 @@ jobs: echo "=======" git commit -m "Released new version: $COLLECTION_VERSION" git status - git push -u origin $COLLECTION_VERSION + git push origin $COLLECTION_VERSION gh pr create --base main --head $COLLECTION_VERSION --title "Release $COLLECTION_VERSION" --body "Release $COLLECTION_VERSION" tag-release: From f8b9e78e726fdb55bd39bb2047cf0bfe8f34e3b4 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 17:43:28 +0530 Subject: [PATCH 238/248] Updated config.yml --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c0202d020..6818657cc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -273,8 +273,9 @@ jobs: echo "=======" git commit -m "Released new version: $COLLECTION_VERSION" git status + echo "Pushing $COLLECTION_VERSION" git push origin $COLLECTION_VERSION - gh pr create --base main --head $COLLECTION_VERSION --title "Release $COLLECTION_VERSION" --body "Release $COLLECTION_VERSION" + gh pr create --base main --head $COLLECTION_VERSION --title 'Release $COLLECTION_VERSION' --body 'Release $COLLECTION_VERSION' tag-release: From 72861383f80cbf6d10eb437ed7837d83de04ffb5 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 18:21:51 +0530 Subject: [PATCH 239/248] Updated config.yml --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6818657cc..df5f8a1b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -284,6 +284,10 @@ jobs: resource_class: cisco/ansible-dcnm steps: - checkout + - add_ssh_keys: + fingerprints: + - "86:8f:9e:6b:83:f4:70:9a:e9:af:77:3d:55:fa:21:da" + - run: name: Create Tag and Release on gh and then publish to ansible-galaxy command: | From 4613ed3d1b469d7ecff1ae542955788cef81f664 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 18:28:01 +0530 Subject: [PATCH 240/248] Updated config.yml --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index df5f8a1b2..c71e333f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -287,7 +287,6 @@ jobs: - add_ssh_keys: fingerprints: - "86:8f:9e:6b:83:f4:70:9a:e9:af:77:3d:55:fa:21:da" - - run: name: Create Tag and Release on gh and then publish to ansible-galaxy command: | From cb96a6f4d08680fd2a7c4051411b80c78065e944 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 19:09:41 +0530 Subject: [PATCH 241/248] Updated config.yml --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c71e333f9..e83df8912 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -284,12 +284,15 @@ jobs: resource_class: cisco/ansible-dcnm steps: - checkout + - add_ssh_keys: fingerprints: - - "86:8f:9e:6b:83:f4:70:9a:e9:af:77:3d:55:fa:21:da" + - "30:a4:04:2a:24:5d:53:a3:54:b0:d6:a1:9e:97:bf:9a" + - run: name: Create Tag and Release on gh and then publish to ansible-galaxy command: | + source temp.txt git checkout main git tag -a $COLLECTION_VERSION -m "Ansible NDFC Collection Version $COLLECTION_VERSION" From e4491ee5d084878f11c8cfc10ef4a838e8a1b2e7 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 22:40:41 +0530 Subject: [PATCH 242/248] Update releaseinfo.yaml --- releaseinfo.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/releaseinfo.yaml b/releaseinfo.yaml index d263f65b0..4ba1a0320 100644 --- a/releaseinfo.yaml +++ b/releaseinfo.yaml @@ -1,9 +1,9 @@ -version: "1.2.8" -release_title: "Ansible ndfc 1.2.8" +version: "1.2.9" +release_title: "Ansible ndfc 1.2.9" release_desc: "Cisco Ansible DCNM Collection" changes: added: - - "Support to configure muliple interfaces for vrf_lite on a vrf" + - "Support to configure multiple interfaces for vrf_lite on a vrf" - "Added support for more switch roles in inventory module." fixed: From d09c4a44842780b4a2bbee2030b7202f0a605772 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 23:04:06 +0530 Subject: [PATCH 243/248] Update releaseinfo.yaml --- releaseinfo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/releaseinfo.yaml b/releaseinfo.yaml index 4ba1a0320..edbb7ca80 100644 --- a/releaseinfo.yaml +++ b/releaseinfo.yaml @@ -1,5 +1,5 @@ -version: "1.2.9" -release_title: "Ansible ndfc 1.2.9" +version: "1.2.10" +release_title: "Ansible ndfc 1.2.10" release_desc: "Cisco Ansible DCNM Collection" changes: added: From dd49a5db61f3f0ef8a290d342e77fb7193fd5cf1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Thu, 20 Jul 2023 23:11:13 +0530 Subject: [PATCH 244/248] Update releaseinfo.yaml --- releaseinfo.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/releaseinfo.yaml b/releaseinfo.yaml index edbb7ca80..2d3f5fd17 100644 --- a/releaseinfo.yaml +++ b/releaseinfo.yaml @@ -1,10 +1,11 @@ -version: "1.2.10" -release_title: "Ansible ndfc 1.2.10" +version: "1.2.11" +release_title: "Ansible ndfc 1.2.11" release_desc: "Cisco Ansible DCNM Collection" changes: added: - "Support to configure multiple interfaces for vrf_lite on a vrf" - "Added support for more switch roles in inventory module." + - "Change 3" fixed: - "https://github.com/CiscoDevNet/ansible-dcnm/issues/204" From d3227307e8e6521d69b8db751990f4ddfb193cdd Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Fri, 21 Jul 2023 09:56:42 +0530 Subject: [PATCH 245/248] Updated config.yml --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e83df8912..746773a47 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -275,7 +275,7 @@ jobs: git status echo "Pushing $COLLECTION_VERSION" git push origin $COLLECTION_VERSION - gh pr create --base main --head $COLLECTION_VERSION --title 'Release $COLLECTION_VERSION' --body 'Release $COLLECTION_VERSION' + gh pr create --base main --head $COLLECTION_VERSION --title "Release $COLLECTION_VERSION" --body "Release $COLLECTION_VERSION" tag-release: @@ -301,7 +301,7 @@ jobs: ansible-galaxy collection build mkdir ./tmp/ ansible-galaxy collection install cisco-dcnm-$COLLECTION_VERSION.tar.gz -p ./tmp/ - ansible-galaxy collection publish ./cisco-dcnm-3.3.1.tar.gz --api-key + # ansible-galaxy collection publish ./cisco-dcnm-3.3.1.tar.gz --api-key= rm temp.txt From dbcfb3fca9985b2db97fdeda1ce948e982f348f7 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 25 Jul 2023 18:53:28 +0530 Subject: [PATCH 246/248] Update releaseinfo.yaml --- releaseinfo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/releaseinfo.yaml b/releaseinfo.yaml index 2d3f5fd17..435858249 100644 --- a/releaseinfo.yaml +++ b/releaseinfo.yaml @@ -1,5 +1,5 @@ -version: "1.2.11" -release_title: "Ansible ndfc 1.2.11" +version: "1.2.15" +release_title: "Ansible ndfc 1.2.15" release_desc: "Cisco Ansible DCNM Collection" changes: added: From d81e174b6053fd831969e32863bbaa04ba36df15 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani <136296284+Pari-Dhanani@users.noreply.github.com> Date: Tue, 25 Jul 2023 19:21:06 +0530 Subject: [PATCH 247/248] Update releaseinfo.yaml --- releaseinfo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/releaseinfo.yaml b/releaseinfo.yaml index 435858249..d5e89cb59 100644 --- a/releaseinfo.yaml +++ b/releaseinfo.yaml @@ -1,5 +1,5 @@ -version: "1.2.15" -release_title: "Ansible ndfc 1.2.15" +version: "3.3.8" +release_title: "Ansible ndfc 3.3.8" release_desc: "Cisco Ansible DCNM Collection" changes: added: From d0fd803ab287b4e6b12a000fe6b98249fddf40d1 Mon Sep 17 00:00:00 2001 From: Pari-Dhanani Date: Tue, 25 Jul 2023 06:51:47 -0700 Subject: [PATCH 248/248] Released new version: 3.3.8 --- CHANGELOG.md | 13 +++++++++++++ README.md | 2 +- galaxy.yml | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7b4c57c5..ee5946fd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased + +## [3.3.8] - 2023-07-25 + +### Added +* Support to configure multiple interfaces for vrf_lite on a vrf +* Added support for more switch roles in inventory module. +* Change 3 + +### Fixed +* https://github.com/CiscoDevNet/ansible-dcnm/issues/204 +* https://github.com/CiscoDevNet/ansible-dcnm/issues/205 +* https://github.com/CiscoDevNet/ansible-dcnm/issues/206 +* Removed the restriction on netcommon version supported by DCNM collection. The restriction was introduced as fix for CiscoDevNet#209. Netcommon versions >=2.6.1 is supported. ## [3.3.0] - 2023-05-23 diff --git a/README.md b/README.md index a64831ed6..f72d64d57 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ You can also include it in a `requirements.yml` file and install it with `ansibl --- collections: - name: cisco.dcnm - version: 3.3.0 + version: 3.3.8 ``` ## Using this collection diff --git a/galaxy.yml b/galaxy.yml index dad67956f..d55a9a16b 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: cisco name: dcnm -version: 3.3.0 +version: 3.3.8 readme: README.md authors: - Shrishail Kariyappanavar