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

"eos_static_routes" state merged and replaced are acting the same way #532

Open
ivanchakarov opened this issue Apr 22, 2024 · 0 comments
Open
Assignees

Comments

@ivanchakarov
Copy link

SUMMARY

State "replaced" for the collection "eos_static_routes" is not working as described in the documentation. It is working exactly the same way as state "merged".

ISSUE TYPE
  • Bug Report
COMPONENT NAME

arista.eos.eos_static_routes

ANSIBLE VERSION
ansible [core 2.15.8]
  config file = /home/ichakarov/GitLab/halo-arista-switches/ansible.cfg
  configured module search path = ['/home/ichakarov/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/ichakarov/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
# /home/ichakarov/.ansible/collections/ansible_collections
Collection Version
---------- -------
arista.eos 9.0.0  
CONFIGURATION
CONFIG_FILE() = /home/ichakarov/GitLab/halo-arista-switches/ansible.cfg
OS / ENVIRONMENT

Arista vEOS-lab
Software image version: 4.31.1F

STEPS TO REPRODUCE

I have the following play

- name: Create static routes
  arista.eos.eos_static_routes:
    config:
      - address_families:
          - afi: ipv4
            routes:
              - dest: 0.0.0.0/0
                next_hops:
                  - interface: 172.16.16.1
              - dest: 10.10.0.0/16
                next_hops:
                  - interface: 172.16.16.1
    state: replaced
EXPECTED RESULTS

If we don't have any static routes on the target switch, it works as expected. It configures both routes.

We have an issue if there is a third route configured on the switch, for example:

ip route 0.0.0.0/0 172.16.16.1
ip route 10.1.1.2/32 172.16.16.1
ip route 10.10.0.0/16 172.16.16.1

The expectation is that "ip route 10.1.1.2/32 172.16.16.1" has to be deleted. Unfortunately, it is not

ACTUAL RESULTS

As you can see below, in the "before" stage it sees that we have 3 routes on the switch and even though the desired state is to have only two the play does not delete the unnecessary one.

The documentation for the collection says that it should delete the third (and any unwanted) route.

TASK [routing : Create static routes] ****************************************************************************************************************************************************************************************
task path: /home/ichakarov/GitLab/halo-arista-switches/roles/routing/tasks/main.yaml:1
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
ok: [pal01-sw01] => {
    "before": [
        {
            "address_families": [
                {
                    "afi": "ipv4",
                    "routes": [
                        {
                            "dest": "0.0.0.0/0",
                            "next_hops": [
                                {
                                    "interface": "172.16.16.1"
                                }
                            ]
                        },
                        {
                            "dest": "10.1.1.2/32",
                            "next_hops": [
                                {
                                    "interface": "172.16.16.1"
                                }
                            ]
                        },
                        {
                            "dest": "10.10.0.0/16",
                            "next_hops": [
                                {
                                    "interface": "172.16.16.1"
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ],
    "changed": false,
    "commands": [],
    "invocation": {
        "module_args": {
            "config": [
                {
                    "address_families": [
                        {
                            "afi": "ipv4",
                            "routes": [
                                {
                                    "dest": "0.0.0.0/0",
                                    "next_hops": [
                                        {
                                            "admin_distance": null,
                                            "description": null,
                                            "forward_router_address": null,
                                            "interface": "172.16.16.1",
                                            "mpls_label": null,
                                            "nexthop_grp": null,
                                            "tag": null,
                                            "track": null,
                                            "vrf": null
                                        }
                                    ]
                                },
                                {
                                    "dest": "10.10.0.0/16",
                                    "next_hops": [
                                        {
                                            "admin_distance": null,
                                            "description": null,
                                            "forward_router_address": null,
                                            "interface": "172.16.16.1",
                                            "mpls_label": null,
                                            "nexthop_grp": null,
                                            "tag": null,
                                            "track": null,
                                            "vrf": null
                                        }
                                    ]
                                }
                            ]
                        }
                    ],
                    "vrf": null
                }
            ],
            "running_config": null,
            "state": "replaced"
        }
    }
}

PLAY RECAP *******************************************************************************************************************************************************************************************************************
pal01-sw01                 : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
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

No branches or pull requests

2 participants