-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Remove incorrect
vrf
keyword from static_route configurations (#…
…513) * Fix: Remove incorrect 'vrf' keyword from static_route configurations * add changelog * chore: auto fixes from pre-commit.com hooks * changes * add unit tests * chore: auto fixes from pre-commit.com hooks * fix tests * chore: auto fixes from pre-commit.com hooks * changelog change * add in_vrf flag to check for vrf context and add tests * add more tests * correct ci test failures * minor changes * chore: auto fixes from pre-commit.com hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f1d214b
commit ad23170
Showing
16 changed files
with
386 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
bugfixes: | ||
- iosxr_static_routes - Fix incorrect handling of the vrf keyword between the destination address and next-hop interface in both global and VRF contexts for IPv4 and IPv6 static_route configurations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/integration/targets/iosxr_static_routes/fixtures/parsed.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 18 additions & 56 deletions
74
tests/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,20 @@ | ||
--- | ||
- name: Setup | ||
cisco.iosxr.iosxr_static_routes: | ||
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 | ||
description: LAB | ||
metric: 120 | ||
tag: 10 | ||
- name: Populate configuration for IOS-XR static routes | ||
cisco.iosxr.iosxr_config: | ||
lines: | ||
- "router static" | ||
- " address-family ipv4 multicast" | ||
- " 192.0.2.16/28 192.0.2.10 FastEthernet0/0/0/1 description LAB metric 120 tag 10" | ||
- " 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1" | ||
- " 192.0.2.32/28 192.0.2.11 100" | ||
- " address-family ipv6 unicast" | ||
- " 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC" | ||
- " 2001:db8:1000::/36 2001:db8:2000:2::1 FastEthernet0/0/0/8" | ||
- "vrf DEV_SITE" | ||
- " address-family ipv4 unicast" | ||
- " 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV" | ||
- " 192.0.2.48/28 192.0.3.24 GigabitEthernet0/0/0/1 vrflabel 2302" | ||
- " 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 track ip_sla_2 vrflabel 124" | ||
|
||
- interface: FastEthernet0/0/0/5 | ||
track: ip_sla_1 | ||
|
||
- dest: 192.0.2.32/28 | ||
next_hops: | ||
- forward_router_address: 192.0.2.11 | ||
admin_distance: 100 | ||
|
||
- afi: ipv6 | ||
safi: unicast | ||
routes: | ||
- dest: 2001:db8:1000::/36 | ||
next_hops: | ||
- interface: FastEthernet0/0/0/7 | ||
description: DC | ||
|
||
- interface: FastEthernet0/0/0/8 | ||
forward_router_address: 2001:db8:2000:2::1 | ||
|
||
- vrf: DEV_SITE | ||
address_families: | ||
- afi: ipv4 | ||
safi: unicast | ||
routes: | ||
- dest: 192.0.2.48/28 | ||
next_hops: | ||
- forward_router_address: 192.0.2.12 | ||
description: DEV | ||
dest_vrf: test_1 | ||
|
||
- forward_router_address: 192.0.3.24 | ||
interface: GigabitEthernet0/0/0/1 | ||
vrflabel: 2302 | ||
|
||
- dest: 192.0.2.80/28 | ||
next_hops: | ||
- interface: FastEthernet0/0/0/2 | ||
forward_router_address: 192.0.2.14 | ||
dest_vrf: test_1 | ||
track: ip_sla_2 | ||
vrflabel: 124 | ||
state: merged | ||
parents: | ||
- "router static" |
17 changes: 12 additions & 5 deletions
17
tests/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
--- | ||
- name: Remove static routes | ||
vars: | ||
lines: "no router static\n" | ||
- name: Remove static route configuration for IOS-XR | ||
cisco.iosxr.iosxr_config: | ||
lines: | ||
- " no address-family ipv4 multicast" | ||
- " no address-family ipv6 unicast" | ||
- "no vrf DEV_SITE" | ||
- "no vrf DEV_NEW" | ||
- "no vrf TEST_SITE" | ||
- "no vrf TEST_VRF" | ||
|
||
parents: | ||
- "router static" | ||
ignore_errors: true | ||
ansible.netcommon.cli_config: | ||
config: "{{ lines }}" |
60 changes: 30 additions & 30 deletions
60
tests/integration/targets/iosxr_static_routes/tests/cli/delete_specific.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
--- | ||
- ansible.builtin.debug: | ||
msg: Start iosxr_static_routes deleted integration tests ansible_connection={{ ansible_connection }} | ||
# --- | ||
# - ansible.builtin.debug: | ||
# msg: Start iosxr_static_routes deleted integration tests ansible_connection={{ ansible_connection }} | ||
|
||
- ansible.builtin.include_tasks: _remove_config.yaml | ||
# - ansible.builtin.include_tasks: _remove_config.yaml | ||
|
||
- ansible.builtin.include_tasks: _populate_config.yaml | ||
# - ansible.builtin.include_tasks: _populate_config.yaml | ||
|
||
- block: | ||
- name: Delete specific static route entry. | ||
register: result | ||
cisco.iosxr.iosxr_static_routes: &id001 | ||
config: | ||
- vrf: DEV_SITE | ||
address_families: | ||
- afi: ipv4 | ||
safi: unicast | ||
routes: | ||
- dest: 192.0.2.48/28 | ||
next_hops: | ||
- forward_router_address: 192.0.2.12 | ||
description: DEV | ||
dest_vrf: test_1 | ||
state: deleted | ||
# - block: | ||
# - name: Delete specific static route entry. | ||
# register: result | ||
# cisco.iosxr.iosxr_static_routes: &id001 | ||
# config: | ||
# - vrf: DEV_SITE | ||
# address_families: | ||
# - afi: ipv4 | ||
# safi: unicast | ||
# routes: | ||
# - dest: 192.0.2.48/28 | ||
# next_hops: | ||
# - forward_router_address: 192.0.2.12 | ||
# description: DEV | ||
# dest_vrf: test_1 | ||
# state: deleted | ||
|
||
- ansible.builtin.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 vrf test_1 192.0.2.12" in result.commands' | ||
- result.commands|length == 4 | ||
always: | ||
- ansible.builtin.include_tasks: _remove_config.yaml | ||
# - ansible.builtin.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 vrf test_1 192.0.2.12" in result.commands' | ||
# - result.commands|length == 4 | ||
# always: | ||
# - ansible.builtin.include_tasks: _remove_config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.