diff --git a/tests/integration/targets/nxos_vrf_interfaces/tests/common/gathered.yaml b/tests/integration/targets/nxos_vrf_interfaces/tests/common/gathered.yaml index 2c96fe709..28d46f965 100644 --- a/tests/integration/targets/nxos_vrf_interfaces/tests/common/gathered.yaml +++ b/tests/integration/targets/nxos_vrf_interfaces/tests/common/gathered.yaml @@ -16,7 +16,13 @@ ansible.builtin.assert: that: - not result.changed - - "{{ gathered['config'] | symmetric_difference(result['gathered']) |length == 0 }}" + - > + {{ + result['gathered'] + | selectattr('name', 'in', 'Ethernet1/2,Ethernet1/6') + | symmetric_difference(gathered['config']) + | length == 0 + }} always: - ansible.builtin.include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/nxos_vrf_interfaces/tests/common/merged.yaml b/tests/integration/targets/nxos_vrf_interfaces/tests/common/merged.yaml index 3bec76054..1f01ba06d 100644 --- a/tests/integration/targets/nxos_vrf_interfaces/tests/common/merged.yaml +++ b/tests/integration/targets/nxos_vrf_interfaces/tests/common/merged.yaml @@ -23,12 +23,24 @@ - name: Assert that before dicts are correctly generated ansible.builtin.assert: that: - - "{{ merged['before'] | symmetric_difference(result['before']) | length == 0 }}" + - > + {{ + result['before'] + | selectattr('name', 'in', 'Ethernet1/2,Ethernet1/6') + | symmetric_difference(merged['before']) + | length == 0 + }} - name: Assert that after dict is correctly generated ansible.builtin.assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) | length == 0 }}" + - > + {{ + result['after'] + | selectattr('name', 'in', 'Ethernet1/2,Ethernet1/6') + | symmetric_difference(merged['after']) + | length == 0 + }} - name: Merge provided configuration with device configuration (idempotent) register: result diff --git a/tests/integration/targets/nxos_vrf_interfaces/tests/common/overridden.yaml b/tests/integration/targets/nxos_vrf_interfaces/tests/common/overridden.yaml index 01800c8d5..0816b2b13 100644 --- a/tests/integration/targets/nxos_vrf_interfaces/tests/common/overridden.yaml +++ b/tests/integration/targets/nxos_vrf_interfaces/tests/common/overridden.yaml @@ -23,12 +23,24 @@ - name: Assert that before dicts are correctly generated ansible.builtin.assert: that: - - overridden['before'] == result['before'] + - > + {{ + result['before'] + | selectattr('name', 'in', 'Ethernet1/2,Ethernet1/6') + | symmetric_difference(overridden['before']) + | length == 0 + }} - name: Assert that after dict is correctly generated ansible.builtin.assert: that: - - overridden['after'] == result['after'] + - > + {{ + result['after'] + | selectattr('name', 'in', 'Ethernet1/2,Ethernet1/6') + | symmetric_difference(overridden['after']) + | length == 0 + }} - name: Override provided configuration with device configuration (idempotent) register: result diff --git a/tests/integration/targets/nxos_vrf_interfaces/tests/common/replaced.yaml b/tests/integration/targets/nxos_vrf_interfaces/tests/common/replaced.yaml index 3a3240a08..ecad626cb 100644 --- a/tests/integration/targets/nxos_vrf_interfaces/tests/common/replaced.yaml +++ b/tests/integration/targets/nxos_vrf_interfaces/tests/common/replaced.yaml @@ -24,12 +24,24 @@ - name: Assert that before dicts are correctly generated ansible.builtin.assert: that: - - replaced['before'] == result['before'] + - > + {{ + result['before'] + | selectattr('name', 'in', 'Ethernet1/2,Ethernet1/6') + | symmetric_difference(replaced['before']) + | length == 0 + }} - name: Assert that after dict is correctly generated ansible.builtin.assert: that: - - replaced['after'] == result['after'] + - > + {{ + result['after'] + | selectattr('name', 'in', 'Ethernet1/2,Ethernet1/6') + | symmetric_difference(replaced['after']) + | length == 0 + }} - name: Replace provided VRF interfaces configuration (idempotent) register: result diff --git a/tests/integration/targets/nxos_vrf_interfaces/tests/common/rtt.yaml b/tests/integration/targets/nxos_vrf_interfaces/tests/common/rtt.yaml index f5890e29a..1f7e85dc8 100644 --- a/tests/integration/targets/nxos_vrf_interfaces/tests/common/rtt.yaml +++ b/tests/integration/targets/nxos_vrf_interfaces/tests/common/rtt.yaml @@ -36,7 +36,7 @@ - ansible.builtin.assert: that: - result.changed == true - - result.commands|symmetric_difference(overridden.commands) == [] + - result.commands|symmetric_difference(rtt.commands_no_revert) == [] - name: Revert back to base configuration using facts round trip register: revert diff --git a/tests/integration/targets/nxos_vrf_interfaces/vars/main.yaml b/tests/integration/targets/nxos_vrf_interfaces/vars/main.yaml index 68b71dbfe..685fbec44 100644 --- a/tests/integration/targets/nxos_vrf_interfaces/vars/main.yaml +++ b/tests/integration/targets/nxos_vrf_interfaces/vars/main.yaml @@ -1,10 +1,10 @@ --- gathered: config: - - name: "Ethernet1/1" - name: "Ethernet1/2" - - name: "Ethernet1/3" - - name: "Ethernet1/4" + vrf_name: "test" + - name: "Ethernet1/6" + vrf_name: "test2" merged: commands: @@ -13,15 +13,11 @@ merged: - interface Ethernet1/6 - vrf member test2 before: - - name: "Ethernet1/1" - name: "Ethernet1/2" - - name: "Ethernet1/3" - name: "Ethernet1/6" after: - - name: "Ethernet1/1" - name: "Ethernet1/2" vrf_name: "test" - - name: "Ethernet1/3" - name: "Ethernet1/6" vrf_name: "test2" @@ -32,16 +28,13 @@ overridden: - interface Ethernet1/6 - vrf member VRF9 before: - - name: "Ethernet1/1" - name: "Ethernet1/2" - vrf_name: "vrf_B" - - name: "Ethernet1/3" + vrf_name: "test" - name: "Ethernet1/6" + vrf_name: "test2" after: - - name: "Ethernet1/1" - name: "Ethernet1/2" vrf_name: "VRF8" - - name: "Ethernet1/3" - name: "Ethernet1/6" vrf_name: "VRF9" @@ -49,7 +42,7 @@ parsed: after: - name: "Ethernet1/2" vrf_name: "VRF1" - - name: "GigabitEthernet1/6" + - name: "Ethernet1/6" vrf_name: "TEST_VRF" replaced: @@ -59,17 +52,13 @@ replaced: - interface Ethernet1/6 - vrf member TEST_VRF3 before: - - name: "Ethernet1/1" - name: "Ethernet1/2" vrf_name: "test" - - name: "Ethernet1/3" - name: "Ethernet1/6" vrf_name: "test2" after: - - name: "Ethernet1/1" - name: "Ethernet1/2" vrf_name: "TEST_VRF2" - - name: "Ethernet1/3" - name: "Ethernet1/6" vrf_name: "TEST_VRF3" @@ -93,7 +82,12 @@ deleted: rtt: commands: - - interface "Ethernet1/6" + - interface Ethernet1/6 - vrf member test - interface Ethernet1/2 - no vrf member test2 + commands_no_revert: + - interface Ethernet1/2 + - vrf member test2 + - interface Ethernet1/6 + - no vrf member test