Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Remove incorrect vrf keyword from static_route configurations #513

Merged
merged 19 commits into from
Oct 23, 2024

Conversation

Ruchip16
Copy link
Contributor

@Ruchip16 Ruchip16 commented Sep 27, 2024

SUMMARY

In the static_route resource module, the vrf keyword is incorrectly added between the destination address and the next hop interface in both global and VRF contexts when configuring static routes. This causes the configuration to be invalid, as the vrf keyword should not be present in this context. The bug affects both IPv4 and IPv6 static routes.

Fixes ANA-547

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

static_routes.py

ADDITIONAL INFORMATION

Original Behaviour:

Global Context:

router static
 address-family ipv4 unicast
  192.168.17.0/24 vrf Loopback0
 address-family ipv6 unicast
  2001:db8::/64 vrf Loopback0

VRF Context:

router static
 vrf TEST_PARTNER
  address-family ipv4 unicast
   192.168.17.0/24 vrf Loopback0
  address-family ipv6 unicast
   2001:db8::/64 vrf Loopback0

Corrected Behaviour:

Global Context:

router static
 address-family ipv4 unicast
  192.168.17.0/24 Loopback0
 address-family ipv6 unicast
  2001:db8::/64 Loopback0

VRF Context:

router static
 vrf TEST_PARTNER
  address-family ipv4 unicast
   192.168.17.0/24 Loopback0
  address-family ipv6 unicast
   2001:db8::/64 Loopback0

Test Playbook :

---
- name: Test static route configuration on IOS XR
  hosts: iosxr
  gather_facts: false
  connection: network_cli
  tasks:
    - name: Configure IPv4 static route in global context
      cisco.iosxr.iosxr_static_routes:
        config:
          - address_families:
              - afi: ipv4
                safi: multicast
                routes:
                  - dest: 192.168.17.0/24
                    next_hops:
                      - interface: Loopback0

    - name: Configure IPv6 static route in global context
      cisco.iosxr.iosxr_static_routes:
        config:
          - address_families:
              - afi: ipv6
                safi: unicast
                routes:
                  - dest: 2001:db8::/64
                    next_hops:
                      - interface: Loopback0

    - name: Configure IPv4 static route in VRF context
      cisco.iosxr.iosxr_static_routes:
        config:
          - vrf: TEST_PARTNER
            address_families:
              - afi: ipv4
                safi: unicast
                routes:
                  - dest: 192.1.0.0/24
                    next_hops:
                      - interface: Loopback1

    - name: Configure IPv6 static route in VRF context
      cisco.iosxr.iosxr_static_routes:
        config:
          - vrf: TEST_PARTNER
            address_families:
              - afi: ipv6
                safi: unicast
                routes:
                  - dest: 2002:db8::/64
                    next_hops:
                      - interface: Loopback1

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.85%. Comparing base (8f9341d) to head (2e93e3a).
Report is 30 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #513      +/-   ##
==========================================
+ Coverage   76.91%   77.85%   +0.93%     
==========================================
  Files         166      176      +10     
  Lines       11298    11577     +279     
==========================================
+ Hits         8690     9013     +323     
+ Misses       2608     2564      -44     
Flag Coverage Δ
77.85% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 114 files with indirect coverage changes

@Ruchip16 Ruchip16 merged commit ad23170 into main Oct 23, 2024
48 checks passed
@Ruchip16 Ruchip16 deleted the static_routes branch October 23, 2024 15:56
@Ruchip16 Ruchip16 mentioned this pull request Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants