mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
nxos_static_route: reconcile_candidate fails to remove 'track' routes (#53806)
* * `reconcile_candidate()`
* old code searched the ip route configs for a given prefix+nexthop and then tried to remove the route based on prefix+nexthop only; this would fail when a static route was configured with `track` values.
* new code still looks for prefix+nexthop but uses the route config it finds on the device to remove it; e.g.
* search for: `ip route 192.168.20.64/24 192.0.2.3`
* find: `ip route 192.168.20.64/24 192.0.2.3 track 1 10`
* remove: `no ip route 192.168.20.64/24 192.0.2.3 track 1 10`
* logic cleanups:
* old code did a `show run` for every prefix. This can be a lot of data when there are large configs.
* new code uses filters to only return the static route configs.
* The filters now allow a common code path so no need for default vs vrf code paths
* `sanity` test: 100% Pass rate on N9K,N7K,N6K,N3K
- Bugfix Pull Request
`nxos_static_route`
* filter() does not return a list with python3
`filter()` was breaking pytest when it ran with python3, since it returns
an iterable instead of a list with python3.
Found that I didn't really need `filter()` anyway so just removed it
* restore var names /w/want/
This commit is contained in:
committed by
Trishna Guha
parent
f885717f74
commit
7b44bc1ac9
@@ -22,6 +22,28 @@
|
||||
|
||||
- debug: msg="Test Track Feature {{ test_track_feature }}"
|
||||
|
||||
- name: Setup and teardown, remove test routes if present
|
||||
nxos_static_route: &setup_teardown
|
||||
aggregate:
|
||||
- { prefix: "192.168.1.164/32", next_hop: "192.0.2.3" }
|
||||
- { prefix: "192.168.20.64/24", next_hop: "192.0.2.3" }
|
||||
- { prefix: "192.168.22.64/24", next_hop: "192.0.2.3" }
|
||||
- { prefix: "192.168.24.64/24", next_hop: "192.0.2.3" }
|
||||
vrf: "{{ item }}"
|
||||
provider: "{{ connection }}"
|
||||
state: absent
|
||||
with_items: "{{ vrfs }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Setup noise routes to ensure testing while non-test routes present
|
||||
nxos_static_route:
|
||||
prefix: "192.168.1.164/32"
|
||||
next_hop: "192.0.2.3"
|
||||
vrf: "{{ item }}"
|
||||
provider: "{{ connection }}"
|
||||
state: present
|
||||
with_items: "{{ vrfs }}"
|
||||
|
||||
- block:
|
||||
- name: create static route
|
||||
nxos_static_route: &configure_static
|
||||
@@ -178,26 +200,9 @@
|
||||
ignore_errors: yes
|
||||
when: test_track_feature
|
||||
|
||||
- name: remove static route
|
||||
nxos_static_route:
|
||||
prefix: "192.168.20.64/24"
|
||||
next_hop: "192.0.2.3"
|
||||
route_name: testing
|
||||
pref: 100
|
||||
tag: 5500
|
||||
vrf: "{{ item }}"
|
||||
provider: "{{ connection }}"
|
||||
state: absent
|
||||
- name: teardown test routes
|
||||
nxos_static_route: *setup_teardown
|
||||
with_items: "{{ vrfs }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: remove static route aggregate
|
||||
nxos_static_route:
|
||||
aggregate:
|
||||
- { prefix: "192.168.22.64/24", next_hop: "192.0.2.3" }
|
||||
- { prefix: "192.168.24.64/24", next_hop: "192.0.2.3" }
|
||||
provider: "{{ connection }}"
|
||||
state: absent
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END connection={{ ansible_connection }} nxos_static_route sanity test"
|
||||
|
||||
Reference in New Issue
Block a user