Skip to content

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

@mahoutukaisali

Description

@mahoutukaisali
SUMMARY

nxos_static_routes module deletes all static routes when playbook specifies no-exist static route.

Example:
[1] NXOS has static routes like following below.

nxos# show running-config | include route
  limit-resource m4route-mem minimum 58 maximum 58
  limit-resource m6route-mem minimum 8 maximum 8
ip route 172.26.66.32/28 192.168.10.54
ip route 172.26.66.48/28 192.168.10.54
  name TEST-nxos_static_routes

[2] Execute the below playbook against the NXOS.

---
- hosts: NX-OS
  tasks:
    - name: Delete Static Route
      cisco.nxos.nxos_static_routes:
        config:
          - address_families:
              - afi: ipv4
                routes:
                  - dest: 172.26.66.113/28  #<---does not exist on the current nxos route
                    next_hops:
                      - forward_router_address: 192.168.10.54
        state: deleted

[3] After a playbook execution, the static routes "ip route 172.26.66.32/28 192.168.10.54" and "ip route 172.26.66.48/28 192.168.10.54" are deleted.

nxos# show running-config | include route
  limit-resource m4route-mem minimum 58 maximum 58
  limit-resource m6route-mem minimum 8 maximum 8
  name TEST-nxos_static_routes

The expected behavior is that the module should NOT delete unrelated routes and also the playbook status should be "ok" instead of "changed" to leave the static routes.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cisco.nxos.nxos_static_routes
cisco.nxos version: 10.2.0

ANSIBLE VERSION

ansible [core 2.16.14]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.11 (main, Dec  9 2024, 15:32:27) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] (/usr/bin/python3.11)
  jinja version = 3.1.6
  libyaml = True

COLLECTION VERSION
ansible-galaxy collection list cisco.nxos

# /usr/share/ansible/collections/ansible_collections
Collection Version
---------- -------
cisco.nxos 10.2.0
CONFIGURATION
CONFIG_FILE() = /etc/ansible/ansible.cfg
OS / ENVIRONMENT

Target OS

Nexus 9000v is a demo version of the Nexus Operating System

Software
  BIOS: version 
  NXOS: version 10.3(3) [Feature Release]
  BIOS compile time:  
  NXOS image file is: bootflash:///nxos64-cs.10.3.3.F.bin
  NXOS compile time:  4/30/2023 12:00:00 [05/03/2023 12:18:42]

Hardware
  cisco Nexus9000 C9300v Chassis 
  Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz with 16384716 kB of memory.
  Processor Board ID 9M82ZHV54TR
  Device name: nxos
  bootflash:    4287040 kB
STEPS TO REPRODUCE

See the description.

EXPECTED RESULTS
  • The module should NOT delete all the static routes even if the module specifies the static routes which does not exist in the current target node.
  • The playbook status should be "ok" instead of "changed" to keep the current static routes.
ACTUAL RESULTS
  • The module deletes static routes unnecessarily.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions