diff --git a/tests/integration/targets/iosxr_static_routes/tests/cli/merged.yaml b/tests/integration/targets/iosxr_static_routes/tests/cli/merged.yaml index 871a3524..1ab0df6e 100644 --- a/tests/integration/targets/iosxr_static_routes/tests/cli/merged.yaml +++ b/tests/integration/targets/iosxr_static_routes/tests/cli/merged.yaml @@ -7,7 +7,7 @@ - block: - name: Merge the provided configuration with the existing running configuration register: result - cisco.iosxr.iosxr_static_routes: &id001 + cisco.iosxr.iosxr_static_routes: config: - address_families: - afi: ipv4 @@ -92,19 +92,10 @@ that: - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: Merge the provided configuration with the existing running configuration (idempotent) - register: result - cisco.iosxr.iosxr_static_routes: *id001 - - name: Assert that the previous task was idempotent - ansible.builtin.assert: - that: - - result['changed'] == false - - result.commands|length == 0 - - name: Assert that before dicts were correctly generated ansible.builtin.assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" + - "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Update existing configuration using merged register: result diff --git a/tests/integration/targets/iosxr_static_routes/vars/main.yaml b/tests/integration/targets/iosxr_static_routes/vars/main.yaml index 495f7f72..40c7aa14 100644 --- a/tests/integration/targets/iosxr_static_routes/vars/main.yaml +++ b/tests/integration/targets/iosxr_static_routes/vars/main.yaml @@ -23,11 +23,10 @@ merged: - vrf DEV_SITE - address-family ipv4 unicast - 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV - - 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 track ip_sla_2 vrflabel - 124 + - 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 track ip_sla_2 vrflabel 124 - vrf TEST_VRF - address-family ipv4 unicast - - 192.1.0.0/24 Loopback1 + - 192.1.0.0/24 vrf Loopback1 update_commands: - router static - vrf DEV_SITE @@ -97,11 +96,17 @@ merged: - dest: 192.1.0.0/24 next_hops: - dest_vrf: Loopback1 - - interface: Loopback1 + interface: Loopback1 safi: unicast vrf: TEST_VRF update_after: - address_families: + - afi: ipv4 + routes: + - dest: 0.0.0.0/0 + next_hops: + - forward_router_address: 10.0.151.254 + safi: unicast - afi: ipv4 routes: - dest: 192.0.2.16/28 @@ -117,6 +122,9 @@ merged: next_hops: - admin_distance: 100 forward_router_address: 192.0.2.11 + - dest: 192.168.17.0/24 + next_hops: + - interface: Loopback0 safi: multicast - afi: ipv6 routes: @@ -126,6 +134,9 @@ merged: interface: FastEthernet0/0/0/7 - forward_router_address: 2001:db8:2000:2::1 interface: FastEthernet0/0/0/8 + - dest: 2001:db8::/64 + next_hops: + - interface: Loopback0 safi: unicast - address_families: - afi: ipv4 @@ -146,6 +157,15 @@ merged: description: rt_test_1 safi: unicast vrf: DEV_SITE + - address_families: + - afi: ipv4 + routes: + - dest: 192.1.0.0/24 + next_hops: + - dest_vrf: Loopback1 + interface: Loopback1 + safi: unicast + vrf: TEST_VRF replaced: before: - address_families: diff --git a/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py b/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py index 88c86369..cb0aa70f 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py @@ -435,11 +435,8 @@ def test_iosxr_static_routes_overridden(self): ) commands = [ "router static", - "no address-family ipv4 unicast", - "no address-family ipv6 unicast", - "no address-family ipv4 multicast", - "no vrf DEV_SITE", "no vrf TEST_VRF", + "no vrf DEV_SITE", "vrf DEV_SITE_NEW", "address-family ipv4 unicast", "192.0.4.16/28 192.0.2.10 FastEthernet0/0/0/1 description LAB metric 120 tag 10",