Skip to content

Commit 358d737

Browse files
[TRM] Add BGP MVPN Address Family Support in Terraform Module (#96)
* feat: Add BGP IPv4 MVPN address family module support - Add iosxe_bgp_address_family_ipv4_mvpn resource mapping - Add bgp_ipv4_mvpn_neighbors locals block - Add iosxe_bgp_ipv4_mvpn_neighbor resource mapping - Support neighbor activate and send_community attributes - Use try() pattern for optional attributes with defaults Related to https://github.com/netascode/nac-iosxe/issues/402 * ci: retrigger build after provider and schema merge * docs: add BGP MVPN resources to README * docs: add BGP MVPN resources to module documentation - Add iosxe_bgp_address_family_ipv4_mvpn resource reference - Add iosxe_bgp_ipv4_mvpn_neighbor resource reference Updated by terraform-docs pre-commit hook --------- Co-authored-by: Andrea Testino <atestini@cisco.com>
1 parent 1aec4a7 commit 358d737

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ module "iosxe" {
8080
| [iosxe_bfd_template_single_hop.bfd_template_single_hop](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bfd_template_single_hop) | resource |
8181
| [iosxe_bgp.bgp](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp) | resource |
8282
| [iosxe_bgp_address_family_ipv4.bgp_address_family_ipv4](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp_address_family_ipv4) | resource |
83+
| [iosxe_bgp_address_family_ipv4_mvpn.bgp_address_family_ipv4_mvpn](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp_address_family_ipv4_mvpn) | resource |
8384
| [iosxe_bgp_address_family_ipv4_vrf.bgp_address_family_ipv4_vrf](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp_address_family_ipv4_vrf) | resource |
8485
| [iosxe_bgp_address_family_ipv6.bgp_address_family_ipv6](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp_address_family_ipv6) | resource |
8586
| [iosxe_bgp_address_family_ipv6_vrf.bgp_address_family_ipv6_vrf](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp_address_family_ipv6_vrf) | resource |
8687
| [iosxe_bgp_address_family_l2vpn.bgp_address_family_l2vpn](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp_address_family_l2vpn) | resource |
88+
| [iosxe_bgp_ipv4_mvpn_neighbor.bgp_ipv4_mvpn_neighbor](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp_ipv4_mvpn_neighbor) | resource |
8789
| [iosxe_bgp_ipv4_unicast_neighbor.bgp_ipv4_unicast_neighbor](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp_ipv4_unicast_neighbor) | resource |
8890
| [iosxe_bgp_ipv4_unicast_vrf_neighbor.bgp_ipv4_unicast_vrf_neighbor](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp_ipv4_unicast_vrf_neighbor) | resource |
8991
| [iosxe_bgp_ipv6_unicast_neighbor.bgp_ipv6_unicast_neighbor](https://registry.terraform.io/providers/CiscoDevNet/iosxe/0.11.0/docs/resources/bgp_ipv6_unicast_neighbor) | resource |

iosxe_bgp.tf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,14 @@ resource "iosxe_bgp_address_family_l2vpn" "bgp_address_family_l2vpn" {
245245
bgp_nexthop_trigger_delay = try(local.device_config[each.value.name].routing.bgp.address_family.l2vpn_evpn.bgp_nexthop_trigger_delay, local.defaults.iosxe.configuration.routing.bgp.address_family.l2vpn_evpn.bgp_nexthop_trigger_delay, null)
246246
}
247247

248+
resource "iosxe_bgp_address_family_ipv4_mvpn" "bgp_address_family_ipv4_mvpn" {
249+
for_each = { for device in local.devices : device.name => device if try(local.device_config[device.name].routing.bgp.address_family.ipv4_mvpn, null) != null }
250+
device = each.value.name
251+
252+
asn = iosxe_bgp.bgp[each.value.name].asn
253+
af_name = "mvpn"
254+
}
255+
248256
resource "iosxe_bgp_address_family_ipv4_vrf" "bgp_address_family_ipv4_vrf" {
249257
for_each = { for device in local.devices : device.name => device if try(local.device_config[device.name].routing.bgp.address_family.ipv4_unicast.vrfs, null) != null }
250258
device = each.value.name
@@ -445,6 +453,33 @@ resource "iosxe_bgp_l2vpn_evpn_neighbor" "bgp_l2vpn_evpn_neighbor" {
445453
]
446454
}
447455

456+
locals {
457+
bgp_ipv4_mvpn_neighbors = flatten([
458+
for device in local.devices : [
459+
for neighbor in try(local.device_config[device.name].routing.bgp.address_family.ipv4_mvpn.neighbors, []) : {
460+
key = format("%s/%s", device.name, neighbor.ip)
461+
device = device.name
462+
asn = iosxe_bgp.bgp[device.name].asn
463+
ip = neighbor.ip
464+
activate = try(neighbor.activate, local.defaults.iosxe.configuration.routing.bgp.address_family.ipv4_mvpn.neighbors.activate, null)
465+
send_community = try(neighbor.send_community, local.defaults.iosxe.configuration.routing.bgp.address_family.ipv4_mvpn.neighbors.send_community, null)
466+
}
467+
]
468+
])
469+
}
470+
471+
resource "iosxe_bgp_ipv4_mvpn_neighbor" "bgp_ipv4_mvpn_neighbor" {
472+
for_each = { for e in local.bgp_ipv4_mvpn_neighbors : e.key => e }
473+
device = each.value.device
474+
475+
asn = each.value.asn
476+
ip = each.value.ip
477+
activate = each.value.activate
478+
send_community = each.value.send_community
479+
480+
depends_on = [iosxe_bgp_neighbor.bgp_neighbor]
481+
}
482+
448483
locals {
449484
bgp_ipv4_unicast_vrf_neighbors = flatten([
450485
for device in local.devices : [

0 commit comments

Comments
 (0)