From 001931e515613ec201aa9ca24fcea7827507b303 Mon Sep 17 00:00:00 2001 From: Allen Robel Date: Wed, 11 Dec 2024 11:03:24 -1000 Subject: [PATCH] IT: interface var naming change 1. The current interface var names did not incorporate a way to encode switch ownership. Modified the var naming to allow for specifying multiple interfaces per switch in such a way that the switch ownership of an interface is evident. This is documented in: playbooks/files/dynamic_inventory.py 2. Modified all dcnm_vrf test cases to align with this convention. - Updated test case header comments with the new usage - Updated all test case interface vars - Ran the following tests - deleted.yaml - overridden.yaml - replaced.yaml - query.yaml - sanity.yaml 3. dynamic_interface.py In addition to the changes above: - Fixed the documentation for environment variable ND_ROLE (previously it was misnamed NDFC_ROLE in the documentation, but was correct -- ND_ROLE -- in the actual usage). - Fix Markdown heading levels --- playbooks/files/dynamic_inventory.py | 86 ++- .../targets/dcnm_vrf/tests/dcnm/deleted.yaml | 26 +- .../targets/dcnm_vrf/tests/dcnm/merged.yaml | 44 +- .../dcnm_vrf/tests/dcnm/overridden.yaml | 24 +- .../targets/dcnm_vrf/tests/dcnm/query.yaml | 22 +- .../targets/dcnm_vrf/tests/dcnm/replaced.yaml | 24 +- .../targets/dcnm_vrf/tests/dcnm/sanity.yaml | 629 ++++++++++-------- .../self-contained-tests/deleted_vrf_all.yaml | 45 +- .../self-contained-tests/merged_vrf_all.yaml | 39 +- .../overridden_vrf_all.yaml | 55 +- .../replaced_vrf_all.yaml | 47 +- .../dcnm/self-contained-tests/scale.yaml | 21 +- .../dcnm/self-contained-tests/vrf_lite.yaml | 149 +++-- 13 files changed, 747 insertions(+), 464 deletions(-) diff --git a/playbooks/files/dynamic_inventory.py b/playbooks/files/dynamic_inventory.py index 6c4365726..a5abf16f7 100755 --- a/playbooks/files/dynamic_inventory.py +++ b/playbooks/files/dynamic_inventory.py @@ -26,12 +26,13 @@ """ # Summary -Dynamic inventory for DCNM Collection integration tests. -Inventory is built from environment variables. +Optional dynamic inventory for the ansible-dcnm repository +integration tests. This inventory is built from environment +variables. -# Usage +## Usage -## Mandatory general variables +### Mandatory general variables The following general environment variables are related to credentials, controller reachability, and role/testcase @@ -43,7 +44,7 @@ setup and the roles/testcases you are running. ```bash -export NDFC_ROLE=dcnm_vrf # The role to run +export ND_ROLE=dcnm_vrf # The role to run export ND_TESTCASE=query # The testcase to run export ND_IP4=10.1.1.1 # Controller IPv4 address export ND_PASSWORD=MyPassword # Controller password @@ -52,7 +53,7 @@ export NXOS_USERNAME=admin # Switch username ``` -## Fabrics +### Fabrics We can add more fabrics later as the need arises... @@ -63,18 +64,48 @@ ``` -## Interfaces +### Interfaces Interface usage varies by testcase. See individual testcase YAML files for details regarding each test's usage. +#### Interface naming convention + +##### Environment variables + +ND_INTERFACE_[A][b] + +Where: + +A - The number of the switch to which the interface belongs +b - An incrementing lower-case letter in range a-z + +###### Examples: + ```bash -export ND_INTERFACE_1=Ethernet1/1 -export ND_INTERFACE_2=Ethernet1/2 -export ND_INTERFACE_3=Ethernet1/3 +export ND_INTERFACE_1a=Ethernet1/1 +export ND_INTERFACE_2a=Ethernet1/1 +export ND_INTERFACE_2b=Ethernet1/2 +export ND_INTERFACE_3a=Ethernet2/4 ``` +Above: + +- switch_1 has one interface; Ethernet1/1 +- switch_2 two interfaces; Ethernet1/1 and Ethernet1/2 +- switch_3 has one interface; Ethernet2/4 + +##### Test case variables + +Interface variables within test cases follow the same convention +as above, but are lowercase, and remove the leading ND_. + +###### Examples + +interface_1a - 1st interface on switch_1 +interface_1b - 2st interface on switch_1 +etc... """ nd_role = environ.get("ND_ROLE", "dcnm_vrf") @@ -109,9 +140,10 @@ switch_3 = environ.get("ND_SWITCH_3_IP4", "10.1.1.108") # Base set of interfaces -interface_1 = environ.get("ND_INTERFACE_1", "Ethernet1/1") -interface_2 = environ.get("ND_INTERFACE_2", "Ethernet1/2") -interface_3 = environ.get("ND_INTERFACE_3", "Ethernet1/3") +interface_1a = environ.get("ND_INTERFACE_1a", "Ethernet1/1") +interface_2a = environ.get("ND_INTERFACE_2a", "Ethernet1/1") +interface_2b = environ.get("ND_INTERFACE_2b", "Ethernet1/2") +interface_3a = environ.get("ND_INTERFACE_3a", "Ethernet1/3") if nd_role == "dcnm_vrf": # VXLAN/EVPN Fabric Name @@ -129,18 +161,17 @@ # - merged # - NOT vrf-lite capable switch_3 = leaf_3 - # interface_1 + # interface_1a # - no tests - # interface_2 - # - all tests + # interface_2a + # - [deleted, merged, overridden, query, replaced, vrf_lite] + # - switch_2 VRF LITE extensions + # interface_2b + # - [vrf_lite] # - switch_2 VRF LITE extensions - # interface_3 - # - merged + # interface_3a + # - [merged, vrf_lite] # - switch_3 non-vrf-lite capable switch - # - overridden - # - Removed from test due to unrelated IP POOL errors. - # - It appears that fabric would need to have SUBNET - # resource added? # elif nd_role == "vrf_lite": # VXLAN/EVPN Fabric Name @@ -149,7 +180,7 @@ switch_1 = spine_1 # switch_2: vrf-lite capable switch_2 = spine_2 - # switch_3: vrf-lite capable + # switch_3: vrf capable switch_3 = bgw_1 else: switch_1 = leaf_1 @@ -170,6 +201,7 @@ "ansible_password": nd_password, "ansible_python_interpreter": "python", "ansible_user": nd_username, + "testcase": nd_testcase, "fabric_1": fabric_1, "fabric_2": fabric_2, "fabric_3": fabric_3, @@ -192,10 +224,10 @@ "switch_1": switch_1, "switch_2": switch_2, "switch_3": switch_3, - "interface_1": interface_1, - "interface_2": interface_2, - "interface_3": interface_3, - "testcase": nd_testcase, + "interface_1a": interface_1a, + "interface_2a": interface_2a, + "interface_2b": interface_2b, + "interface_3a": interface_3a, }, }, "dcnm": { diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/deleted.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/deleted.yaml index 34001a9c1..94e19b807 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/deleted.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/deleted.yaml @@ -2,18 +2,22 @@ ## REQUIRED VARS ## ############################################## # fabric_1 -# A VXLAN_EVPN fabric +# +# - A VXLAN_EVPN fabric # # switch_1 -# A vrf-lite capable switch -# Does not require an interface +# +# - A vrf-lite capable switch +# - Does not require an interface # # switch_2 -# A vrf-lite capable switch # -# interface_2 -# Ethernet interface on switch_2 -# used to test VRF LITE configuration. +# - A vrf-lite capable switch +# +# interface_2a +# +# - Ethernet interface on switch_2 +# - Used to test VRF LITE configuration. # ############################################## @@ -36,7 +40,7 @@ - "fabric_1 : {{ fabric_1 }}" - "switch_1 : {{ switch_1 }}" - "switch_2 : {{ switch_2 }}" - - "interface_2 : {{ interface_2 }}" + - "interface_2a : {{ interface_2a }}" - name: SETUP.1 - DELETED - [dcnm_rest.GET] Verify fabric is deployed. cisco.dcnm.dcnm_rest: @@ -157,7 +161,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/30 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional @@ -205,7 +209,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/30 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional @@ -260,7 +264,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/30 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/merged.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/merged.yaml index fbd5ab38f..374c8ee39 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/merged.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/merged.yaml @@ -5,23 +5,29 @@ # A VXLAN_EVPN fabric # # switch_1 -# A vrf-lite capable switch -# Does not require an interface. +# +# - A vrf-lite capable switch +# - Does not require an interface. # # switch_2 -# A vrf-lite capable switch +# +# - A vrf-lite capable switch # # switch_3 +# # A NON-vrf-lite capable switch # -# interface_2 -# Ethernet interface on switch_2 -# Used to test VRF LITE configuration. +# interface_2a +# +# - Ethernet interface on switch_2 +# - Used to test VRF LITE configuration. +# +# interface_3a # -# interface_3 -# Ethernet interface on switch_3 -# Used to verify error when applied VRF LITE -# extension on a non-vrf-lite capable switch. +# - Ethernet interface on switch_3 +# - Used to verify error when applying a +# VRF LITE extension on a non-vrf-lite +# capable switch. ############################################## ############################################## @@ -44,8 +50,8 @@ - "switch_1 : {{ switch_1 }}" - "switch_2 : {{ switch_2 }}" - "switch_3 : {{ switch_3 }}" - - "interface_2 : {{ interface_2 }}" - - "interface_3 : {{ interface_3 }}" + - "interface_2a : {{ interface_2a }}" + - "interface_3a : {{ interface_3a }}" - name: SETUP.1 - MERGED - [dcnm_rest.GET] Verify fabric is deployed. cisco.dcnm.dcnm_rest: @@ -132,19 +138,19 @@ - 'result_1c.changed == false' - 'result_1c.response|length == 0' -- name: TEST.1d - MERGED - [deleted] Delete all VRFs +- name: TEST.1e - MERGED - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: deleted - register: result_1d + register: result_1e -- name: TEST.1e - MERGED - [wait_for] Wait 60 seconds for controller and switch to sync +- name: TEST.1f - MERGED - [wait_for] Wait 60 seconds for controller and switch to sync # The vrf lite profile removal returns ok for deployment, but the switch # takes time to remove the profile so wait for some time before creating # a new vrf, else the switch goes into OUT-OF-SYNC state wait_for: timeout: 60 - when: result_1d.changed == true + when: result_1e.changed == true - name: TEST.2 - MERGED - [merged] Create, Attach, Deploy VLAN+VRF (controller provided) cisco.dcnm.dcnm_vrf: &conf2 @@ -228,7 +234,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/30 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional @@ -304,7 +310,7 @@ - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" vrf_lite: - - interface: "{{ interface_2 }}" # mandatory + - interface: "{{ interface_2a }}" # mandatory deploy: true register: result_4 @@ -428,7 +434,7 @@ - ip_address: "{{ switch_3 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_3 }}" # mandatory + interface: "{{ interface_3a }}" # mandatory ipv4_addr: 10.33.0.2/30 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/overridden.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/overridden.yaml index 0ba1c5465..bddf59af9 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/overridden.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/overridden.yaml @@ -2,17 +2,21 @@ ## REQUIRED VARS ## ############################################## # fabric_1 -# A VXLAN_EVPN fabric +# +# - A VXLAN_EVPN fabric # # switch_1 -# A vrf-lite capable switch +# +# - A vrf-lite capable switch # # switch_2 -# A vrf-lite capable switch # -# interface_2 -# Ethernet interface on switch_2 -# Used to test VRF LITE configuration. +# - A vrf-lite capable switch +# +# interface_2a +# +# - Ethernet interface on switch_2 +# - Used to test VRF LITE configuration. # ############################################## @@ -47,7 +51,7 @@ - "fabric_1 : {{ fabric_1 }}" - "switch_1 : {{ switch_1 }}" - "switch_2 : {{ switch_2 }}" - - "interface_2 : {{ interface_2 }}" + - "interface_2a : {{ interface_2a }}" - name: SETUP.1 - OVERRIDDEN - [dcnn_rest.GET] Verify if fabric is deployed. cisco.dcnm.dcnm_rest: @@ -198,7 +202,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int2 # optional - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.1/24 # optional neighbor_ipv4: 10.33.0.0 # optional ipv6_addr: 2010::10:34:0:7/64 # optional @@ -254,7 +258,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int2 # optional - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.1/24 # optional neighbor_ipv4: 10.33.0.0 # optional ipv6_addr: 2010::10:34:0:7/64 # optional @@ -330,7 +334,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.1/24 # optional neighbor_ipv4: 10.33.0.0 # optional ipv6_addr: 2010::10:34:0:1/64 # optional diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/query.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/query.yaml index ec0b4c8a0..f92d99bb7 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/query.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/query.yaml @@ -2,17 +2,21 @@ ## REQUIRED VARS ## ############################################## # fabric_1 -# A VXLAN_EVPN fabric +# +# - A VXLAN_EVPN fabric # # switch_1 -# A vrf-lite capable switch +# +# - A vrf-lite capable switch # # switch_2 -# A vrf-lite capable switch # -# interface_2 -# Ethernet interface on switch_2 -# Used to test VRF LITE configuration. +# - A vrf-lite capable switch +# +# interface_2a +# +# - Ethernet interface on switch_2 +# - Used to test VRF LITE configuration. ############################################## ############################################## @@ -34,7 +38,7 @@ - "fabric_1 : {{ fabric_1 }}" - "switch_1 : {{ switch_1 }}" - "switch_2 : {{ switch_2 }}" - - "interface_2 : {{ interface_2 }}" + - "interface_2a : {{ interface_2a }}" - name: SETUP.1 - QUERY - [dcnm_rest.GET] Verify if fabric is deployed. cisco.dcnm.dcnm_rest: @@ -226,7 +230,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int2 # peer_vrf is mandatory - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/30 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional @@ -274,7 +278,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int2 # peer_vrf is mandatory - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/30 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/replaced.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/replaced.yaml index 2ac00ad55..caacdeb74 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/replaced.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/replaced.yaml @@ -2,18 +2,22 @@ ## REQUIRED VARS ## ############################################## # fabric_1 -# A VXLAN_EVPN fabric +# +# - A VXLAN_EVPN fabric # # switch_1 -# A vrf-lite capable switch -# Does not require an interface +# +# - A vrf-lite capable switch +# - Does not require an interface # # switch_2 -# A vrf-lite capable switch # -# interface_2 -# Ethernet interface on switch_2 -# used to test VRF LITE configuration. +# - A vrf-lite capable switch +# +# interface_2a +# +# - Ethernet interface on switch_2 +# - Used to test VRF LITE configuration. # ############################################## @@ -36,7 +40,7 @@ - "fabric_1 : {{ fabric_1 }}" - "switch_1 : {{ switch_1 }}" - "switch_2 : {{ switch_2 }}" - - "interface_2 : {{ interface_2 }}" + - "interface_2a : {{ interface_2a }}" - name: SETUP.1 - REPLACED - [dcnm_rest.GET] Verify if fabric is deployed. cisco.dcnm.dcnm_rest: @@ -231,7 +235,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/30 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional @@ -337,7 +341,7 @@ - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/30 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml index 46def14db..5b31ecd11 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml @@ -1,49 +1,76 @@ +############################################## +## REQUIRED VARS ## +############################################## +# fabric_1 +# +# - A VXLAN_EVPN fabric +# +# switch_1 +# +# - A vrf-lite capable switch +# - Does not require an interface +# +# switch_2 +# +# - A vrf-lite capable switch +# - Does not require an interface +# +############################################## + ############################################## ## SETUP ## ############################################## - set_fact: - rest_path: "/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" tags: - sanity - set_fact: - rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" tags: - sanity -- name: SANITY- MERGED - Verify if fabric is deployed. +- name: SETUP.0 - SANITY - [with_items] print vars + ansible.builtin.debug: + var: item + with_items: + - "fabric_1 : {{ fabric_1 }}" + - "switch_1 : {{ switch_1 }}" + - "switch_2 : {{ switch_2 }}" + +- name: SETUP.1 - SANITY - Verify if fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" - register: result + register: result_setup_1 tags: sanity - assert: that: - - 'result.response.DATA != None' + - 'result_setup_1.response.DATA != None' tags: sanity -- name: SANITY- MERGED - Clean up any existing vrfs +- name: SETUP.2 - SANITY - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted tags: sanity -- name: SANITY- Pause for 20 seconds for NDFC to sync - ansible.builtin.pause: - seconds: 20 +- name: SETUP.3 - SANITY - [wait_for] Wait 60 seconds for controller and switch to sync + wait_for: + timeout: 60 tags: sanity ############################################### ### MERGED ## ############################################### -- name: SANITY- MERGED - Create, Attach and Deploy new VRF - VLAN Provided by the User - cisco.dcnm.dcnm_vrf: &conf - fabric: "{{ test_fabric }}" +- name: TEST.1 - SANITY MERGED - [merged] Create, Attach, Deploy VLAN+VRF - VLAN Provided by the User + cisco.dcnm.dcnm_vrf: &conf1 + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -52,67 +79,77 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true - register: result + register: result_1 tags: sanity -- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state +- name: TEST.1a - SANITY MERGED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query - register: query_result + register: result_1a until: - - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result_1a.response[0].parent.vrfStatus is search('DEPLOYED')" retries: 30 delay: 2 tags: sanity +- name: TEST.1b - SANITY MERGED - [debug] print result_1 + ansible.builtin.debug: + var: result_1 + 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"' + - 'result_1.changed == true' + - 'result_1.response[0].RETURN_CODE == 200' + - 'result_1.response[1].RETURN_CODE == 200' + - 'result_1.response[2].RETURN_CODE == 200' + - '(result_1.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_1.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_1.diff[0].attach[0].deploy == true' + - 'result_1.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" in result_1.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result_1.diff[0].attach[1].ip_address' + - 'result_1.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: TEST.1c - SANITY MERGED - conf1 - Idempotence + cisco.dcnm.dcnm_vrf: *conf1 + register: result_1c tags: sanity -- name: SANITY- MERGED - conf1 - Idempotence - cisco.dcnm.dcnm_vrf: *conf - register: result +- name: TEST.1d - SANITY MERGED - [debug] print result_1c + ansible.builtin.debug: + var: result_1c tags: sanity - assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result_1c.changed == false' + - 'result_1c.response|length == 0' tags: sanity -- name: SANITY- MERGED - Clean up any existing vrfs +- name: TEST.1e - SANITY MERGED - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted tags: sanity -- name: SANITY- Pause for 20 seconds for NDFC to sync - ansible.builtin.pause: - seconds: 20 +- name: TEST.1f - SANITY MERGED - [wait_for] Wait 60 seconds for controller and switch to sync + wait_for: + timeout: 60 tags: sanity ############################################### ### REPLACED ## ############################################### -- name: SANITY- REPLACED - Create, Attach and Deploy new VRF - VLAN Provided by the User +- name: TEST.2 - SANITY REPLACED - [merged] Create, Attach, Deploy VLAN+VRF Provided by the User cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -121,39 +158,44 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true - register: result + register: result_2 tags: sanity -- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state +- name: TEST.2a - SANITY REPLACED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query - register: query_result + register: result_2a until: - - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result_2a.response[0].parent.vrfStatus is search('DEPLOYED')" retries: 30 delay: 2 tags: sanity +- name: TEST.2b - SANITY REPLACED - [debug] print result_2 + ansible.builtin.debug: + var: result_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: SANITY- REPLACED - Update existing VRF using replace - delete attachments - cisco.dcnm.dcnm_vrf: &conf1 - fabric: "{{ test_fabric }}" + - 'result_2.changed == true' + - 'result_2.response[0].RETURN_CODE == 200' + - 'result_2.response[1].RETURN_CODE == 200' + - 'result_2.response[2].RETURN_CODE == 200' + - '(result_2.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_2.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_2.diff[0].attach[0].deploy == true' + - 'result_2.diff[0].attach[1].deploy == true' + - 'result_2.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: TEST.2c - SANITY REPLACED - [replaced] Update existing VRF - delete attachments + cisco.dcnm.dcnm_vrf: &conf2c + fabric: "{{ fabric_1 }}" state: replaced config: - vrf_name: ansible-vrf-int1 @@ -161,45 +203,60 @@ vrf_template: Default_VRF_Universal vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 - register: result + register: result_2c tags: sanity -- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state +- name: TEST.2d - SANITY REPLACED - [wait_for] Wait 60 seconds for controller and switch to sync + wait_for: + timeout: 60 + tags: sanity + +- name: TEST.2e - SANITY REPLACED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query - register: query_result + register: result_2e until: - - "query_result.response[0].parent.vrfStatus is search('NA')" + - "result_2e.response[0].parent.vrfStatus is search('NA')" retries: 30 delay: 2 tags: sanity +- name: TEST.2f - SANITY REPLACED - [debug] print result_2c + ansible.builtin.debug: + var: result_2c + 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"' + - 'result_2c.changed == true' + - 'result_2c.response[0].RETURN_CODE == 200' + - 'result_2c.response[1].RETURN_CODE == 200' + - '(result_2c.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_2c.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_2c.diff[0].attach[0].deploy == false' + - 'result_2c.diff[0].attach[1].deploy == false' + - 'result_2c.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity -- name: SANITY- REPLACED - conf1 - Idempotence - cisco.dcnm.dcnm_vrf: *conf1 - register: result +- name: TEST.2g - SANITY REPLACED - conf2c - Idempotence + cisco.dcnm.dcnm_vrf: *conf2c + register: result_2g + tags: sanity + +- name: TEST.2h - SANITY REPLACED - [debug] print result_2g + ansible.builtin.debug: + var: result_2g tags: sanity - assert: that: - - 'result.changed == false' + - 'result_2g.changed == false' tags: sanity -- name: SANITY- REPLACED - Update existing VRF using replace - create attachments - cisco.dcnm.dcnm_vrf: &conf2 - fabric: "{{ test_fabric }}" +- name: TEST.2i - SANITY REPLACED - [replaced] Update existing VRF - create attachments + cisco.dcnm.dcnm_vrf: &conf2i + fabric: "{{ fabric_1 }}" state: replaced config: - vrf_name: ansible-vrf-int1 @@ -208,65 +265,80 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true - register: result + register: result_2i tags: sanity -- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state +- name: TEST.2j - SANITY REPLACED - [wait_for] Wait 60 seconds for controller and switch to sync + wait_for: + timeout: 60 + tags: sanity + +- name: TEST.2k - SANITY REPLACED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query - register: query_result + register: result_2k until: - - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result_2k.response[0].parent.vrfStatus is search('DEPLOYED')" retries: 30 delay: 2 tags: sanity +- name: TEST.2l - SANITY REPLACED - [debug] print result_2i + ansible.builtin.debug: + var: result_2i + 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' + - 'result_2i.changed == true' + - 'result_2i.response[0].RETURN_CODE == 200' + - 'result_2i.response[1].RETURN_CODE == 200' + - '(result_2i.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_2i.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_2i.diff[0].attach[0].deploy == true' + - 'result_2i.diff[0].attach[1].deploy == true' + - 'result_2i.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result_2i.diff[0].attach[0].vlan_id == 500' + - 'result_2i.diff[0].attach[1].vlan_id == 500' + tags: sanity + +- name: TEST.2m - SANITY REPLACED - [replaced] conf2i - Idempotence + cisco.dcnm.dcnm_vrf: *conf2i + register: result_2m tags: sanity -- name: SANITY- REPLACED - conf2 - Idempotence - cisco.dcnm.dcnm_vrf: *conf2 - register: result +- name: TEST.2n - SANITY REPLACED - [debug] print result_2m + ansible.builtin.debug: + var: result_2m tags: sanity - assert: that: - - 'result.changed == false' + - 'result_2m.changed == false' tags: sanity -- name: SANITY- REPLACED - Clean up any existing vrfs +- name: TEST.2o - SANITY REPLACED - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted tags: sanity -- name: SANITY- Pause for 20 seconds for NDFC to sync - ansible.builtin.pause: - seconds: 20 +- name: TEST.2p - SANITY REPLACED - [wait_for] Wait 60 seconds for controller and switch to sync + wait_for: + timeout: 60 tags: sanity ############################################### ### OVERRIDDEN ## ############################################### -- name: SANITY- OVERRIDDEN - Create, Attach and Deploy new VRF - VLAN Provided by the User +- name: TEST.3 - SANITY OVERRIDDEN - [merged] Create, Attach, Deploy VLAN+VRF - Provided by the User cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -275,41 +347,46 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true - register: result + register: result_3 tags: sanity -- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state +- name: TEST.3a - SANITY OVERRIDDEN - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query - register: query_result + register: result_3a until: - - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result_3a.response[0].parent.vrfStatus is search('DEPLOYED')" retries: 30 delay: 2 tags: sanity +- name: TEST.3b - SANITY OVERRIDDEN - [debug] print result_3 + ansible.builtin.debug: + var: result_3 + 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: SANITY- OVERRIDDEN - Update existing VRF using overridden - delete and create - cisco.dcnm.dcnm_vrf: &conf3 - fabric: "{{ test_fabric }}" + - 'result_3.changed == true' + - 'result_3.response[0].RETURN_CODE == 200' + - 'result_3.response[1].RETURN_CODE == 200' + - 'result_3.response[2].RETURN_CODE == 200' + - '(result_3.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_3.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_3.diff[0].attach[0].deploy == true' + - 'result_3.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" in result_3.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result_3.diff[0].attach[1].ip_address' + - 'result_3.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: TEST.3c - SANITY OVERRIDDEN - [overridden] Update existing VRF - delete and create + cisco.dcnm.dcnm_vrf: &conf3c + fabric: "{{ fabric_1 }}" state: overridden config: - vrf_name: ansible-vrf-int2 @@ -318,73 +395,83 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true - register: result + register: result_3c tags: sanity -- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state +- name: TEST.3d - SANITY OVERRIDDEN - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query - register: query_result + register: result_3d until: - - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result_3d.response[0].parent.vrfStatus is search('DEPLOYED')" retries: 30 delay: 2 tags: sanity +- name: TEST.3e - SANITY OVERRIDDEN - [debug] print result_3c + ansible.builtin.debug: + var: result_3c + 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: SANITY- OVERRIDDEN - conf - Idempotence - cisco.dcnm.dcnm_vrf: *conf3 - register: result + - 'result_3c.changed == true' + - 'result_3c.response[0].RETURN_CODE == 200' + - 'result_3c.response[1].RETURN_CODE == 200' + - 'result_3c.response[2].RETURN_CODE == 200' + - 'result_3c.response[3].RETURN_CODE == 200' + - 'result_3c.response[4].RETURN_CODE == 200' + - 'result_3c.response[5].RETURN_CODE == 200' + - '(result_3c.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_3c.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - '(result_3c.response[4].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_3c.response[4].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_3c.diff[0].attach[0].deploy == true' + - 'result_3c.diff[0].attach[1].deploy == true' + - 'result_3c.diff[0].vrf_name == "ansible-vrf-int2"' + - 'result_3c.diff[1].attach[0].deploy == false' + - 'result_3c.diff[1].attach[1].deploy == false' + - 'result_3c.diff[1].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: TEST.3f - SANITY OVERRIDDEN - [overridden] conf3c - Idempotence + cisco.dcnm.dcnm_vrf: *conf3c + register: result_3f + tags: sanity + +- name: TEST.3g - SANITY OVERRIDDEN - [debug] print result_3f + ansible.builtin.debug: + var: result_3f tags: sanity - assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result_3f.changed == false' + - 'result_3f.response|length == 0' tags: sanity -- name: SANITY- OVERRIDDEN - Clean up any existing vrfs +- name: TEST.3h - SANITY OVERRIDDEN - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted tags: sanity -- name: SANITY- Pause for 20 seconds for NDFC to sync - ansible.builtin.pause: - seconds: 20 +- name: TEST.3i - SANITY OVERRIDDEN - [wait_for] Wait 60 seconds for controller and switch to sync + wait_for: + timeout: 60 tags: sanity ############################################### ### QUERY ## ############################################### -- name: SANITY- QUERY - Create, Attach and Deploy new VRF - VLAN Provided by the User +- name: TEST.4 - SANITY QUERY - [merged] Create, Attach, Deploy VLAN+VRF - Provided by the User cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -393,41 +480,46 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true - register: result + register: result_4 tags: sanity -- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state +- name: TEST.4a - SANITY QUERY - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query - register: query_result + register: result_4a until: - - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result_4a.response[0].parent.vrfStatus is search('DEPLOYED')" retries: 30 delay: 2 tags: sanity +- name: TEST.4b - SANITY QUERY - [debug] print result_4 + ansible.builtin.debug: + var: result_4 + 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: SANITY- QUERY - Query the VRF + - 'result_4.changed == true' + - 'result_4.response[0].RETURN_CODE == 200' + - 'result_4.response[1].RETURN_CODE == 200' + - 'result_4.response[2].RETURN_CODE == 200' + - '(result_4.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_4.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_4.diff[0].attach[0].deploy == true' + - 'result_4.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" in result_4.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result_4.diff[0].attach[1].ip_address' + - 'result_4.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: TEST.4c - SANITY QUERY - [query] Query the VRF cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query config: - vrf_name: ansible-vrf-int1 @@ -436,45 +528,49 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true - register: result + register: result_4c + tags: sanity + +- name: TEST.4d - SANITY QUERY - [debug] print result_4c + ansible.builtin.debug: + var: result_4c 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: SANITY- QUERY - Clean up existing vrfs + - 'result_4c.changed == false' + - 'result_4c.response[0].parent.vrfName == "ansible-vrf-int1"' + - 'result_4c.response[0].parent.vrfId == 9008011' + - 'result_4c.response[0].parent.vrfStatus == "DEPLOYED"' + - 'result_4c.response[0].attach[0].switchDetailsList[0].islanAttached == true' + - 'result_4c.response[0].attach[0].switchDetailsList[0].lanAttachedState == "DEPLOYED"' + - 'result_4c.response[0].attach[0].switchDetailsList[0].vlan == 500' + - 'result_4c.response[0].attach[1].switchDetailsList[0].islanAttached == true' + - 'result_4c.response[0].attach[1].switchDetailsList[0].lanAttachedState == "DEPLOYED"' + - 'result_4c.response[0].attach[1].switchDetailsList[0].vlan == 500' + tags: sanity + +- name: TEST.4e - SANITY QUERY - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted - register: result tags: sanity -- name: SANITY- Pause for 20 seconds for NDFC to sync - ansible.builtin.pause: - seconds: 20 +- name: TEST.4f - SANITY QUERY - [wait_for] Wait 60 seconds for controller and switch to sync + wait_for: + timeout: 60 tags: sanity ############################################### ### DELETED ## ############################################### -- name: SANITY- DELETED - Create, Attach and Deploy new VRF - VLAN Provided by the User +- name: TEST.5 - SANITY DELETED - Create, Attach, Deploy VLAN+VRF - Provided by the User cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -483,73 +579,88 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true - register: result + register: result_5 tags: sanity -- name: SANITY- Query fabric state until vrfStatus transitions to DEPLOYED state +- name: TEST.5a - SANITY DELETED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query - register: query_result + register: result_5a until: - - "query_result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result_5a.response[0].parent.vrfStatus is search('DEPLOYED')" retries: 30 delay: 2 tags: sanity +- name: TEST.5b - SANITY DELETED - [debug] print result_5 + ansible.builtin.debug: + var: result_5 + 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: SANITY- DELETED - Delete VRF using deleted state - cisco.dcnm.dcnm_vrf: &conf4 - fabric: "{{ test_fabric }}" + - 'result_5.changed == true' + - 'result_5.response[0].RETURN_CODE == 200' + - 'result_5.response[1].RETURN_CODE == 200' + - 'result_5.response[2].RETURN_CODE == 200' + - '(result_5.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_5.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_5.diff[0].attach[0].deploy == true' + - 'result_5.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" in result_5.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result_5.diff[0].attach[1].ip_address' + - 'result_5.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: TEST.5c - SANITY DELETED - [deleted] Delete the VRF + cisco.dcnm.dcnm_vrf: &conf5c + fabric: "{{ fabric_1 }}" state: deleted config: - vrf_name: ansible-vrf-int1 vrf_id: 9008011 vrf_template: Default_VRF_Universal vrf_extension_template: Default_VRF_Extension_Universal - register: result + register: result_5c + tags: sanity + +- name: TEST.5d - SANITY DELETED - [debug] print result_5c + ansible.builtin.debug: + var: result_5c 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"' + - 'result_5c.changed == true' + - 'result_5c.response[0].RETURN_CODE == 200' + - 'result_5c.response[1].RETURN_CODE == 200' + - 'result_5c.response[1].MESSAGE == "OK"' + - 'result_5c.response[2].RETURN_CODE == 200' + - 'result_5c.response[2].METHOD == "DELETE"' + - '(result_5c.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_5c.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_5c.diff[0].attach[0].deploy == false' + - 'result_5c.diff[0].attach[1].deploy == false' + - 'result_5c.diff[0].vrf_name == "ansible-vrf-int1"' + tags: sanity + +- name: TEST.5e - SANITY DELETED - conf5c - Idempotence + cisco.dcnm.dcnm_vrf: *conf5c + register: result_5e tags: sanity -- name: SANITY- DELETED - conf - Idempotence - cisco.dcnm.dcnm_vrf: *conf4 - register: result +- name: TEST.5f - SANITY DELETED - [debug] print result_5e + ansible.builtin.debug: + var: result_5e tags: sanity - assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result_5e.changed == false' + - 'result_5e.response|length == 0' + - 'result_5e.diff|length == 0' tags: sanity - - 'result.diff|length == 0' diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/deleted_vrf_all.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/deleted_vrf_all.yaml index 16f4222ec..5748884fc 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/deleted_vrf_all.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/deleted_vrf_all.yaml @@ -1,13 +1,32 @@ +############################################## +## REQUIRED VARS ## +############################################## +# fabric_1 +# +# - A VXLAN_EVPN fabric +# +# switch_1 +# +# - A vrf-capable switch +# - Does not require an interface +# +# switch_2 +# +# - A vrf-capable switch +# - Does not require an interface +# +############################################## + ############################################## ## SETUP ## ############################################## - set_fact: - rest_path: "/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" - set_fact: - rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" - name: DELETE_ALL - Verify if fabric is deployed. @@ -22,7 +41,7 @@ - name: DELETE_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted ############################################### @@ -31,7 +50,7 @@ - name: DELETE_ALL - Create, Attach and Deploy new VRF with all values cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -55,14 +74,14 @@ bgp_password: "74657374" bgp_passwd_encrypt: 7 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -80,13 +99,13 @@ - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - 'result.diff[0].attach[0].deploy == true' - 'result.diff[0].attach[1].deploy == true' - - '"{{ 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' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - name: DELETE_ALL - Clean existing vrfs cisco.dcnm.dcnm_vrf: &conf - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted register: result @@ -98,8 +117,8 @@ - 'result.response[2].RETURN_CODE == 200' - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' - - '"{{ 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' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - name: DELETE_ALL - conf - Idempotence @@ -117,5 +136,5 @@ - name: DELETE_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/merged_vrf_all.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/merged_vrf_all.yaml index 0f3f69c87..733e3d0a4 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/merged_vrf_all.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/merged_vrf_all.yaml @@ -1,13 +1,32 @@ +############################################## +## REQUIRED VARS ## +############################################## +# fabric_1 +# +# - A VXLAN_EVPN fabric +# +# switch_1 +# +# - A vrf-capable switch +# - Does not require an interface +# +# switch_2 +# +# - A vrf-capable switch +# - Does not require an interface +# +############################################## + ############################################## ## SETUP ## ############################################## - set_fact: - rest_path: "/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" - set_fact: - rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" - name: MERGED_ALL - Verify if fabric is deployed. @@ -22,7 +41,7 @@ - name: MERGED_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted ############################################### @@ -31,7 +50,7 @@ - name: MERGED_ALL - Create, Attach and Deploy new VRF with all values cisco.dcnm.dcnm_vrf: &conf - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -55,14 +74,14 @@ bgp_password: "74657374" bgp_passwd_encrypt: 7 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -80,8 +99,8 @@ - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - 'result.diff[0].attach[0].deploy == true' - 'result.diff[0].attach[1].deploy == true' - - '"{{ 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' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - name: MERGED_ALL - conf - Idempotence @@ -99,5 +118,5 @@ - name: MERGED_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/overridden_vrf_all.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/overridden_vrf_all.yaml index f5d518ba1..fd7cb618a 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/overridden_vrf_all.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/overridden_vrf_all.yaml @@ -1,13 +1,32 @@ +############################################## +## REQUIRED VARS ## +############################################## +# fabric_1 +# +# - A VXLAN_EVPN fabric +# +# switch_1 +# +# - A vrf-capable switch +# - Does not require an interface +# +# switch_2 +# +# - A vrf-capable switch +# - Does not require an interface +# +############################################## + ############################################## ## SETUP ## ############################################## - set_fact: - rest_path: "/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" - set_fact: - rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" - name: OVERRIDDEN_ALL - Verify if fabric is deployed. @@ -22,7 +41,7 @@ - name: OVERRIDDEN_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted ############################################### @@ -31,7 +50,7 @@ - name: OVERRIDDEN_ALL - Create, Attach and Deploy new VRF with all values cisco.dcnm.dcnm_vrf: &conf - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -55,14 +74,14 @@ bgp_password: "74657374" bgp_passwd_encrypt: 7 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -80,8 +99,8 @@ - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - 'result.diff[0].attach[0].deploy == true' - 'result.diff[0].attach[1].deploy == true' - - '"{{ 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' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - name: OVERRIDDEN_ALL - conf - Idempotence @@ -95,7 +114,7 @@ - name: OVERRIDDEN_ALL - Override a existing VRF with a new one cisco.dcnm.dcnm_vrf: &conf1 - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: overridden config: - vrf_name: ansible-vrf-int2 @@ -119,14 +138,14 @@ bgp_password: "74657374" bgp_passwd_encrypt: 7 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -151,10 +170,10 @@ - 'result.diff[0].attach[1].deploy == true' - 'result.diff[1].attach[0].deploy == false' - 'result.diff[1].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' - - '"{{ 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' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[1].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[1].attach[1].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int2"' - 'result.diff[1].vrf_name == "ansible-vrf-int1"' @@ -173,5 +192,5 @@ - name: OVERRIDDEN_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/replaced_vrf_all.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/replaced_vrf_all.yaml index 010bca5d8..7645e5f00 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/replaced_vrf_all.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/replaced_vrf_all.yaml @@ -1,13 +1,32 @@ +############################################## +## REQUIRED VARS ## +############################################## +# fabric_1 +# +# - A VXLAN_EVPN fabric +# +# switch_1 +# +# - A vrf-capable switch +# - Does not require an interface +# +# switch_2 +# +# - A vrf-capable switch +# - Does not require an interface +# +############################################## + ############################################## ## SETUP ## ############################################## - set_fact: - rest_path: "/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" - set_fact: - rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" - name: REPLACED_ALL - Verify if fabric is deployed. @@ -22,7 +41,7 @@ - name: REPLACED_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted ############################################### @@ -31,7 +50,7 @@ - name: REPLACED_ALL - Create, Attach and Deploy new VRF with all values cisco.dcnm.dcnm_vrf: &conf - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -55,14 +74,14 @@ bgp_password: "74657374" bgp_passwd_encrypt: 7 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -80,8 +99,8 @@ - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - 'result.diff[0].attach[0].deploy == true' - 'result.diff[0].attach[1].deploy == true' - - '"{{ 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' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - name: REPLACED_ALL - conf - Idempotence @@ -95,7 +114,7 @@ - name: REPLACED_ALL - Replace VRF with all values cisco.dcnm.dcnm_vrf: &conf1 - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: replaced config: - vrf_name: ansible-vrf-int1 @@ -119,14 +138,14 @@ bgp_password: "74657374" bgp_passwd_encrypt: 7 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -156,5 +175,5 @@ - name: REPLACED_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/scale.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/scale.yaml index 76b82792c..17e6ef2fe 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/scale.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/scale.yaml @@ -1,13 +1,22 @@ +############################################## +## REQUIRED VARS ## +############################################## +# fabric_1 +# +# - A VXLAN_EVPN fabric +# +############################################## + ############################################## ## SETUP ## ############################################## - set_fact: - rest_path: "/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" - set_fact: - rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" - name: SCALE - Verify if fabric is deployed. @@ -22,7 +31,7 @@ - name: SCALE - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted - name: Dummy set fact for leaf_attach_list @@ -36,14 +45,14 @@ - name: Push all VRFs to DCNM cisco.dcnm.dcnm_vrf: - fabric: '{{ test_fabric }}' + fabric: '{{ fabric_1 }}' state: merged config: '{{ vrfs_list }}' register: result - name: SCALE - Clean up existing vrfs cisco.dcnm.dcnm_vrf: &conf - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted - name: SCALE - conf - Idempotence @@ -62,5 +71,5 @@ - name: SCALE - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/vrf_lite.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/vrf_lite.yaml index 6ad41f906..38bb637fe 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/vrf_lite.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/vrf_lite.yaml @@ -1,13 +1,46 @@ +############################################## +## REQUIRED VARS ## +############################################## +# fabric_1 +# A VXLAN_EVPN fabric +# +# switch_1 +# +# - A vrf-lite capable switch +# +# switch_2 +# +# - A vrf-lite capable switch +# +# switch_3 +# +# - A vrf capable switch +# - switch_3 does not require any interfaces +# +# interface_1a +# +# - 1st interface on switch_1 +# +# interface_2a +# +# - 1st interface on switch_2 +# +# interface_2b +# +# - 2nd interface on switch_2 +# +############################################## + ############################################## ## SETUP ## ############################################## - set_fact: - rest_path: "/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" - set_fact: - rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_fabric }}" + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" - name: MERGED - Verify if fabric is deployed. @@ -22,7 +55,7 @@ - name: MERGED - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted - name: VRF LITE - sleep for 40 seconds for DCNM to completely update the state @@ -38,7 +71,7 @@ - name: VRF LITE- Create, Attach and Deploy new VRF - VLAN/VRF LITE EXTENSION Provided by the User in one switch cisco.dcnm.dcnm_vrf: &conf1 - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -47,22 +80,22 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ ansible_int1 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/24 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional neighbor_ipv6: 2010::10:34:0:3 # optional dot1q: 2 # dot1q can be got from dcnm + - ip_address: "{{ switch_3 }}" deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -80,10 +113,10 @@ - '(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' + - '"{{ switch_3 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result.diff[0].attach[1].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - - '"{{ ansible_int1 }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' @@ -98,7 +131,7 @@ - name: VRF LITE- Attach and Deploy second VRF LITE EXTENSION Provided by the User in one switch cisco.dcnm.dcnm_vrf: &conf2 - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int1 @@ -107,29 +140,29 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ ansible_int1 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/24 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional neighbor_ipv6: 2010::10:34:0:3 # optional dot1q: 2 # dot1q can be got from dcnm - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ ansible_int2 }}" # mandatory + interface: "{{ interface_2b }}" # mandatory ipv4_addr: 20.33.0.2/24 # optional neighbor_ipv4: 20.33.0.1 # optional ipv6_addr: 3010::10:34:0:7/64 # optional neighbor_ipv6: 3010::10:34:0:3 # optional dot1q: 21 # dot1q can be got from dcnm - - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ switch_3 }}" deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -144,12 +177,12 @@ - 'result.response[1].RETURN_CODE == 200' - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' - 'result.diff[0].attach[0].deploy == true' - - '"{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - - '"{{ ansible_int1 }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"{{ ansible_int2 }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"{{ interface_2b }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - '"20.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - name: VRF LITE - conf2 - Idempotence @@ -163,7 +196,7 @@ - name: VRF LITE- Replace VRF LITE Attachment and Deploy by the User in one switch cisco.dcnm.dcnm_vrf: &conf3 - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: replaced config: - vrf_name: ansible-vrf-int1 @@ -172,22 +205,22 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 500 attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ ansible_int1 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/24 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional neighbor_ipv6: 2010::10:34:0:3 # optional dot1q: 2 # dot1q can be got from dcnm + - ip_address: "{{ switch_3 }}" deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -202,9 +235,9 @@ - 'result.response[1].RETURN_CODE == 200' - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' - 'result.diff[0].attach[0].deploy == true' - - '"{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - - '"{{ ansible_int1 }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' @@ -219,7 +252,7 @@ - name: VRF LITE- Override VRF and VRF LITE EXTENSION Provided by the User cisco.dcnm.dcnm_vrf: &conf4 - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: overridden config: - vrf_name: ansible-vrf-int2 @@ -228,17 +261,17 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 400 attach: - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ ansible_int1 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/24 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional neighbor_ipv6: 2010::10:34:0:3 # optional dot1q: 2 # dot1q can be got from dcnm - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ ansible_int2 }}" # mandatory + interface: "{{ interface_2b }}" # mandatory ipv4_addr: 20.33.0.2/24 # optional neighbor_ipv4: 20.33.0.1 # optional ipv6_addr: 3010::10:34:0:7/64 # optional @@ -249,7 +282,7 @@ - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -271,15 +304,15 @@ - 'result.diff[0].attach[0].deploy == true' - 'result.diff[1].attach[0].deploy == false' - 'result.diff[1].attach[1].deploy == false' - - '"{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ ansible_switch1 }}" in result.diff[1].attach[0].ip_address' - - '"{{ ansible_switch2 }}" in result.diff[1].attach[1].ip_address' + - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_3 }}" in result.diff[1].attach[0].ip_address' + - '"{{ switch_2 }}" in result.diff[1].attach[1].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int2"' - 'result.diff[1].vrf_name == "ansible-vrf-int1"' - - '"{{ ansible_int1 }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - '"{{ interface_2a }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - '"ansible-vrf-int1" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - '"10.33.0.2/24" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - - '"{{ ansible_int2 }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - '"{{ interface_2b }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - '"20.33.0.2/24" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - name: VRF LITE - conf4 - Idempotence @@ -293,7 +326,7 @@ - name: VRF LITE - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted - name: VRF LITE - sleep for 40 seconds for DCNM to completely update the state @@ -305,7 +338,7 @@ - name: VRF LITE- Create, Attach and Deploy new VRF - VLAN/VRF LITE EXTENSION Provided by the User in multiple switch cisco.dcnm.dcnm_vrf: &conf5 - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: merged config: - vrf_name: ansible-vrf-int2 @@ -314,37 +347,37 @@ vrf_extension_template: Default_VRF_Extension_Universal vlan_id: 400 attach: - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ switch_1 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int3 # optional + interface: "{{ interface_1a }}" # mandatory + ipv4_addr: 40.33.0.2/24 # optional + neighbor_ipv4: 40.33.0.1 # optional + ipv6_addr: 5010::10:34:0:7/64 # optional + neighbor_ipv6: 5010::10:34:0:3 # optional + dot1q: 4 # dot1q can be got from dcnm + - ip_address: "{{ switch_2 }}" vrf_lite: - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ ansible_int1 }}" # mandatory + interface: "{{ interface_2a }}" # mandatory ipv4_addr: 10.33.0.2/24 # optional neighbor_ipv4: 10.33.0.1 # optional ipv6_addr: 2010::10:34:0:7/64 # optional neighbor_ipv6: 2010::10:34:0:3 # optional dot1q: 2 # dot1q can be got from dcnm - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ ansible_int2 }}" # mandatory + interface: "{{ interface_2b }}" # mandatory ipv4_addr: 20.33.0.2/24 # optional neighbor_ipv4: 20.33.0.1 # optional ipv6_addr: 3010::10:34:0:7/64 # optional neighbor_ipv6: 3010::10:34:0:3 # optional dot1q: 21 # dot1q can be got from dcnm - - ip_address: "{{ ansible_switch3 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int3 # optional - interface: "{{ ansible_int3 }}" # mandatory - ipv4_addr: 40.33.0.2/24 # optional - neighbor_ipv4: 40.33.0.1 # optional - ipv6_addr: 5010::10:34:0:7/64 # optional - neighbor_ipv6: 5010::10:34:0:3 # optional - dot1q: 4 # dot1q can be got from dcnm deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: query register: query_result until: @@ -362,16 +395,16 @@ - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - 'result.diff[0].attach[0].deploy == true' - 'result.diff[0].attach[1].deploy == true' - - '"{{ ansible_switch2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ ansible_switch3 }}" in result.diff[0].attach[1].ip_address' + - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - 'result.diff[0].vrf_name == "ansible-vrf-int2"' - - '"{{ ansible_int3 }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - '"{{ interface_1a }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - '"ansible-vrf-int3" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - '"40.33.0.2/24" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - - '"{{ ansible_int1 }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"{{ ansible_int2 }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"{{ interface_2b }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - '"20.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - name: VRF LITE - conf5 - Idempotence @@ -389,5 +422,5 @@ - name: VRF LITE - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: - fabric: "{{ test_fabric }}" + fabric: "{{ fabric_1 }}" state: deleted