--- - debug: msg: "Start iosxr_static_routes deleted integration tests ansible_connection={{ ansible_connection }}" - include_tasks: _remove_config.yaml - include_tasks: _populate_config.yaml - block: - name: Delete a single next_hop from a destination network iosxr_static_routes: &deleted_1 config: - address_families: - afi: ipv4 safi: unicast routes: - dest: 192.0.2.16/28 next_hops: - forward_router_address: 192.0.2.10 interface: FastEthernet0/0/0/1 state: deleted register: result - assert: that: - '"router static" in result.commands' - '"address-family ipv4 unicast" in result.commands' - '"no 192.0.2.16/28 192.0.2.10 FastEthernet0/0/0/1" in result.commands' - 'result.commands|length == 3' - name: Delete a single next_hop from a destination network (IDEMPOTENT) iosxr_static_routes: *deleted_1 register: result - assert: &unchanged that: - "result.changed == false" - "result.commands|length == 0" - name: Delete a destination network entry iosxr_static_routes: &deleted_2 config: - vrf: DEV_SITE address_families: - afi: ipv4 safi: unicast routes: - dest: 192.0.2.48/28 state: deleted register: result - assert: that: - '"router static" in result.commands' - '"vrf DEV_SITE" in result.commands' - '"address-family ipv4 unicast" in result.commands' - '"no 192.0.2.48/28" in result.commands' - "result.commands|length == 4" - name: Delete a destination network entry (IDEMPOTENT) iosxr_static_routes: *deleted_2 register: result - assert: *unchanged - name: Delete all destination network entries under a single AFI iosxr_static_routes: &deleted_3 config: - vrf: DEV_SITE address_families: - afi: ipv4 safi: unicast state: deleted register: result - assert: that: - '"router static" in result.commands' - '"vrf DEV_SITE" in result.commands' - '"no address-family ipv4 unicast" in result.commands' - "result.commands|length == 3" - name: Delete all destination network entries under a single AFI (IDEMPOTENT) iosxr_static_routes: *deleted_3 register: result - assert: *unchanged - include_tasks: _populate_config.yaml - name: Delete static routes configuration iosxr_static_routes: &deleted state: deleted register: result - name: Assert that the before dicts were correctly generated assert: that: - "{{ replaced['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that the correct set of commands were generated assert: that: - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete all static routes (IDEMPOTENT) iosxr_static_routes: *deleted register: result - name: Assert that the previous task was idempotent assert: *unchanged - name: Assert that the before dicts were correctly generated assert: that: - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml