ansible-collections / cisco.nxos

Ansible Network Collection for Cisco NXOS
GNU General Public License v3.0
115 stars 109 forks source link

[nxos_bgp_global] - Add fix for local as options #885

Closed KB-perByte closed 4 weeks ago

KB-perByte commented 1 month ago
SUMMARY

The local_as attribute is to be deprecated in favor of local_as_config. The new option enables facts gathering of neighbors.local_as_config

ISSUE TYPE
COMPONENT NAME

cisco.nxos.nxos_bgp_global

Detects configuration -

nxos# show running-config | section "^router bgp"
router bgp 123
  router-id 1.1.1.1
  neighbor <REDACTED>
    local-as 65022 no-prepend replace-as dual-as
  vrf bgp_vrf
    local-as 651002
    address-family ipv4 unicast
      network <REDACTED>
    neighbor <REDACTED>
      remote-as 65000
      local-as 65024 no-prepend replace-as
      address-family ipv4 unicast

Gathers facts as -

ok: [BATMAN] => {
    "changed": false,
    "gathered": {
        "as_number": "123",
        "neighbors": [
            {
                "local_as_config": {
                    "as_number": "65022",
                    "dual_as": true,
                    "no_prepend": true,
                    "replace_as": true
                },
                "neighbor_address": "<REDACTED>"
            }
        ],
        "router_id": "1.1.1.1",
        "vrfs": [
            {
                "local_as": "651002",
                "neighbors": [
                    {
                        "local_as_config": {
                            "as_number": "65024",
                            "no_prepend": true,
                            "replace_as": true
                        },
                        "neighbor_address": "<REDACTED>",
                        "remote_as": "65000"
                    }
                ],
                "vrf": "bgp_vrf"
            }
        ]
    },
    "invocation": {
        "module_args": {
            "config": null,
            "running_config": null,
            "state": "gathered"
        }
    }
}