Skip to content

Conversation

@h-hirokawa
Copy link

SUMMARY

Enable nxos_static_routes module to modify the routes of Vlan interfaces.
And fix an issue where all unspecified routes are deleted when state: deleted is set and the targeted routes do not exist.

Fixes: #985 and #986

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

nxos_static_routes

@KB-perByte
Copy link
Collaborator

Hi @h-hirokawa Thank you for your contribution.
Considering the state of the appliance -

R1# show running-config | include route
  limit-resource m4route-mem minimum 58 maximum 58
  limit-resource m6route-mem minimum 8 maximum 8
ip route 192.0.2.32/28 198.51.100.54
ip route 192.0.2.48/28 198.51.100.54
  ip route 0.0.0.0/0 203.0.113.1

And a playbook as mentioned.

- name: Delete Static Route
  check_mode: true
  cisco.nxos.nxos_static_routes:
    config:
      - address_families:
          - afi: ipv4
            routes:
              - dest: 192.0.2.113/28
                next_hops:
                  - forward_router_address: 198.51.100.54
    state: deleted

This is expected to delete all route-maps present and not do anything around the porvided route.
As the deleted state does not support granular deletion.

changed: true
commands:
  - no ip route 192.0.2.32/28 198.51.100.54
  - no ip route 192.0.2.48/28 198.51.100.54

this is an expected behaviour

For a situation where you want to keep this new route and remove all other use of the state overridden and replaced is expected.

 - name: Replace existing Static Route
  check_mode: true
  cisco.nxos.nxos_static_routes:
    config:
      - address_families:
          - afi: ipv4
            routes:
              - dest: 192.0.2.113/28  # Does not exist on current NX-OS device
                next_hops:
                  - forward_router_address: 198.51.100.54
    state: replaced

This would generate

commands:
  - ip route 192.0.2.113/28 198.51.100.54
  - no ip route 192.0.2.32/28 198.51.100.54
  - no ip route 192.0.2.48/28 198.51.100.54

The fix for the reported issue is a no fix, #986
#985

We are happy to consider the other change added in the PR around parsers.
I'll keep this PR open for further review

Copy link
Collaborator

@KB-perByte KB-perByte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the comment above.

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.

nxos_static_routes module deletes all static routes when playbook specifies no-exist static route(s)

2 participants