From 769c0f5550fc7e673b6b8c4b8e2e15e6b7f4bdc2 Mon Sep 17 00:00:00 2001 From: Vinay M <63404819+roverflow@users.noreply.github.com> Date: Wed, 15 Jan 2025 09:18:20 +0530 Subject: [PATCH] Fix downstream test failures (#527) --- .../tests/common/_populate.yaml | 27 +++++++++++++++++-- .../tests/common/_remove_config.yaml | 8 ++++++ .../tests/common/merged.yaml | 3 +++ .../tests/common/overridden.yaml | 5 ++-- .../tests/common/_remove_config.yaml | 7 +++++ .../tests/common/overridden.yaml | 1 - .../tests/common/parsed.yaml | 2 +- .../iosxr_vrf_interfaces/vars/main.yaml | 17 +++++++----- 8 files changed, 57 insertions(+), 13 deletions(-) diff --git a/tests/integration/targets/iosxr_vrf_address_family/tests/common/_populate.yaml b/tests/integration/targets/iosxr_vrf_address_family/tests/common/_populate.yaml index f90ffc36..dbdfc616 100644 --- a/tests/integration/targets/iosxr_vrf_address_family/tests/common/_populate.yaml +++ b/tests/integration/targets/iosxr_vrf_address_family/tests/common/_populate.yaml @@ -1,10 +1,30 @@ --- +- name: Enable RM policy rm-policy + register: result + cisco.iosxr.iosxr_config: + lines: + - route-policy rm-policy + - end-policy + +- name: Enable RM policy rm-policy1 + register: result + cisco.iosxr.iosxr_config: + lines: + - route-policy rm-policy1 + - end-policy + +- name: Enable RM policy test-policy + register: result + cisco.iosxr.iosxr_config: + lines: + - route-policy test-policy + - end-policy + - name: Merge provided configuration with device configuration register: result + when: populate_init_config | default(true) cisco.iosxr.iosxr_config: lines: - - vrf VRF4 - - address-family ipv4 unicast - export route-policy rm-policy - export route-target 192.0.2.1:400 - export to default-vrf route-policy rm-policy @@ -15,3 +35,6 @@ - import from default-vrf route-policy test-policy - import from vrf advertise-as-vpn - maximum prefix 100 + parents: + - vrf VRF4 + - address-family ipv4 unicast diff --git a/tests/integration/targets/iosxr_vrf_address_family/tests/common/_remove_config.yaml b/tests/integration/targets/iosxr_vrf_address_family/tests/common/_remove_config.yaml index b6fe6861..9bd8987c 100644 --- a/tests/integration/targets/iosxr_vrf_address_family/tests/common/_remove_config.yaml +++ b/tests/integration/targets/iosxr_vrf_address_family/tests/common/_remove_config.yaml @@ -7,3 +7,11 @@ - no vrf VRF7 - no vrf test register: result + +- name: Remove RM policy + cisco.iosxr.iosxr_config: + lines: + - no route-policy rm-policy + - no route-policy rm-policy1 + - no route-policy test-policy + register: result diff --git a/tests/integration/targets/iosxr_vrf_address_family/tests/common/merged.yaml b/tests/integration/targets/iosxr_vrf_address_family/tests/common/merged.yaml index e56125c0..ebe37b36 100644 --- a/tests/integration/targets/iosxr_vrf_address_family/tests/common/merged.yaml +++ b/tests/integration/targets/iosxr_vrf_address_family/tests/common/merged.yaml @@ -3,6 +3,9 @@ msg: Start iosxr_vrf_address_family merged integration tests connection={{ ansible_connection}} - ansible.builtin.include_tasks: _remove_config.yaml +- ansible.builtin.include_tasks: _populate.yaml + vars: + populate_init_config: false - block: - name: Merge provided configuration with device configuration diff --git a/tests/integration/targets/iosxr_vrf_address_family/tests/common/overridden.yaml b/tests/integration/targets/iosxr_vrf_address_family/tests/common/overridden.yaml index 91a3bbab..cd221773 100644 --- a/tests/integration/targets/iosxr_vrf_address_family/tests/common/overridden.yaml +++ b/tests/integration/targets/iosxr_vrf_address_family/tests/common/overridden.yaml @@ -2,9 +2,10 @@ - ansible.builtin.debug: msg: START iosxr_vrf_address_family overridden integration tests on connection={{ ansible_connection }} -- ansible.builtin.include_tasks: _populate.yaml - - ansible.builtin.include_tasks: _remove_config.yaml +- ansible.builtin.include_tasks: _populate.yaml + vars: + populate_init_config: false - block: - name: Override the provided configuration with the existing running configuration diff --git a/tests/integration/targets/iosxr_vrf_interfaces/tests/common/_remove_config.yaml b/tests/integration/targets/iosxr_vrf_interfaces/tests/common/_remove_config.yaml index 90f7e3c7..5c817029 100644 --- a/tests/integration/targets/iosxr_vrf_interfaces/tests/common/_remove_config.yaml +++ b/tests/integration/targets/iosxr_vrf_interfaces/tests/common/_remove_config.yaml @@ -8,3 +8,10 @@ - name: GigabitEthernet0/0/0/2 vars: ansible_connection: ansible.netcommon.network_cli + +- name: Remove un-neccessary interfaces + cisco.iosxr.iosxr_config: + lines: + - no interface GigabitEthernet0/0/0/4.1 + vars: + ansible_connection: ansible.netcommon.network_cli diff --git a/tests/integration/targets/iosxr_vrf_interfaces/tests/common/overridden.yaml b/tests/integration/targets/iosxr_vrf_interfaces/tests/common/overridden.yaml index 90df9596..1163d237 100644 --- a/tests/integration/targets/iosxr_vrf_interfaces/tests/common/overridden.yaml +++ b/tests/integration/targets/iosxr_vrf_interfaces/tests/common/overridden.yaml @@ -12,7 +12,6 @@ - name: GigabitEthernet0/0/0/0 - name: GigabitEthernet0/0/0/1 vrf_name: vrf_C - - name: GigabitEthernet0/0/0/2 register: result - name: Run show show running-config interface diff --git a/tests/integration/targets/iosxr_vrf_interfaces/tests/common/parsed.yaml b/tests/integration/targets/iosxr_vrf_interfaces/tests/common/parsed.yaml index f0a1461c..bf6c763e 100644 --- a/tests/integration/targets/iosxr_vrf_interfaces/tests/common/parsed.yaml +++ b/tests/integration/targets/iosxr_vrf_interfaces/tests/common/parsed.yaml @@ -11,4 +11,4 @@ - name: Assert that configuration was correctly parsed ansible.builtin.assert: that: - - merged['after'] == result['parsed'] + - parsed['result'] == result['parsed'] diff --git a/tests/integration/targets/iosxr_vrf_interfaces/vars/main.yaml b/tests/integration/targets/iosxr_vrf_interfaces/vars/main.yaml index 489b8a10..c46c48df 100644 --- a/tests/integration/targets/iosxr_vrf_interfaces/vars/main.yaml +++ b/tests/integration/targets/iosxr_vrf_interfaces/vars/main.yaml @@ -9,8 +9,6 @@ gathered: vrf_name: vrf_A - name: GigabitEthernet0/0/0/2 vrf_name: vrf_B - - name: GigabitEthernet0/0/0/7 - - name: TenGigE0/0/0/0 merged: commands: @@ -27,8 +25,6 @@ merged: vrf_name: vrf_C - name: GigabitEthernet0/0/0/2 vrf_name: vrf_D - - name: GigabitEthernet0/0/0/7 - - name: TenGigE0/0/0/0 overridden: commands: @@ -43,9 +39,6 @@ overridden: - name: GigabitEthernet0/0/0/0 - name: GigabitEthernet0/0/0/1 vrf_name: vrf_C - - name: GigabitEthernet0/0/0/2 - - name: GigabitEthernet0/0/0/7 - - name: TenGigE0/0/0/0 before: - name: Loopback888 - name: Loopback999 @@ -55,5 +48,15 @@ overridden: vrf_name: vrf_A - name: GigabitEthernet0/0/0/2 vrf_name: vrf_B +parsed: + result: + - name: Loopback888 + - name: Loopback999 + - name: MgmtEth0/RP0/CPU0/0 + - name: GigabitEthernet0/0/0/0 + - name: GigabitEthernet0/0/0/1 + vrf_name: vrf_C + - name: GigabitEthernet0/0/0/2 + vrf_name: vrf_D - name: GigabitEthernet0/0/0/7 - name: TenGigE0/0/0/0