netascode/terraform-provider-iosxe

Add the ability to assign route-map to a BGP neighbor in address-family (non-VRF and VRF)

Closed this issue · 1 comments

mobig commented

Hello,

Reviewing the restconf of my lab C8000v, there seems to be no restconf path for applying a route-map to a bgp neighbor outside an address-family. Like so:

!
router bgp 65000
  neighbor 192.168.0.152 remote-as 65000
  neighbor 192.168.0.152 description Site-04_01
  neighbor 192.168.0.152 route-map RM2 in
!

This may be by design by Cisco as most people use address-families these days. Like so:

!
router bgp 65000
 neighbor 192.168.0.153 remote-as 65000
 neighbor 192.168.0.153 description Site-04_02
 !
 address-family ipv4
  neighbor 192.168.0.153 activate
  neighbor 192.168.0.153 route-map RM1 in
 exit-address-family
!

It appears the way the resource is structured today is that you must specify a VRF if using iosxe_bgp_ipv4_unicast_vrf_neighbor. There should probably be a change to the resource to add the option of "no-vrf" for BGP neighbors that are a part of the address-family but not in a VRF (like my 2nd example above). This is what the RESTCONF looks like for the 2nd example:

    "router": {
      "Cisco-IOS-XE-bgp:bgp": [
        {
          "id": 65000,
          "bgp": {
            "log-neighbor-changes": true
          },
          "neighbor": [
            {
              "id": "192.168.0.152",
              "remote-as": 65000,
              "description": "Site-04_01"
            }
          ],
          "address-family": {
            "with-vrf": {
              "ipv4": [
                {
                  "af-name": "unicast"
                }
              ]
            },
            "no-vrf": {
              "ipv4": [
                {
                  "af-name": "unicast",
                  "ipv4-unicast": {
                    "neighbor": [
                      {
                        "id": "192.168.0.152",
                        "activate": [null],
                        "route-map": [
                          {
                            "inout": "in",
                            "route-map-name": "RM1"
                          }
                        ]
                      }
                    ]
                  }
                }
              ]
            }
          }
        }
      ]
    }

I have published v0.1.15 with a few new BGP resources to support this.