Skip to content

Conversation

@Dan-Dev-Net
Copy link
Contributor

Related Issue(s)

Fixes: #419

Description

Add support for BGP VPNv4 and VPNv6 unicast address family configuration in the terraform-provider-iosxe.

This PR implements two new resources and data sources:

  • iosxe_bgp_address_family_vpnv4
  • iosxe_bgp_address_family_vpnv6

CLI Commands Supported

router bgp 65000
  address-family vpnv4 unicast
  exit-address-family
  address-family vpnv6 unicast
  exit-address-family

Changes Made

Manual Changes (2 files)

  • gen/definitions/bgp_address_family_vpnv4.yaml - YANG definition for VPNv4 unicast address family
  • gen/definitions/bgp_address_family_vpnv6.yaml - YANG definition for VPNv6 unicast address family

Auto-Generated Files (22 files)

  • Provider resources and data sources for both VPNv4 and VPNv6
  • Model files
  • Test files
  • Documentation (docs/ and examples/)
  • Updated provider.go with new resource registrations

Total: 24 files changed, 2427 insertions(+)

YANG Paths

VPNv4

/Cisco-IOS-XE-native:native/router/Cisco-IOS-XE-bgp:bgp[id=%v]/address-family/no-vrf/vpnv4[af-name=%s]

VPNv6

/Cisco-IOS-XE-native:native/router/Cisco-IOS-XE-bgp:bgp[id=%v]/address-family/no-vrf/vpnv6[af-name=%s]

Example Terraform Configuration

# Create BGP router instance (prerequisite)
resource "iosxe_bgp" "example" {
  asn = 65000
}

# VPNv4 unicast address family
resource "iosxe_bgp_address_family_vpnv4" "example" {
  asn     = 65000
  af_name = "unicast"
  depends_on = [iosxe_bgp.example]
}

# VPNv6 unicast address family
resource "iosxe_bgp_address_family_vpnv6" "example" {
  asn     = 65000
  af_name = "unicast"
  depends_on = [iosxe_bgp.example]
}

Testing

Test Environment

  • Device: Cisco Catalyst 8000V (10.81.239.57)
  • IOS-XE Version: 17.15.01a
  • Test Method: Direct provider testing with local dev override

Test Results

Terraform Plan

Plan: 3 to add, 0 to change, 0 to destroy.

  # iosxe_bgp.test will be created
  # iosxe_bgp_address_family_vpnv4.test will be created
  # iosxe_bgp_address_family_vpnv6.test will be created

Terraform Apply

iosxe_bgp.test: Creation complete after 1s
iosxe_bgp_address_family_vpnv6.test: Creation complete after 3s
iosxe_bgp_address_family_vpnv4.test: Creation complete after 5s

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

Device Verification

Router1#show running-config | section router bgp
router bgp 65000
 bgp log-neighbor-changes
 !
 address-family vpnv4
 exit-address-family
 !
 address-family vpnv6
 exit-address-family

PASSED - Configuration applied correctly to device

Idempotency Test

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

PASSED - No changes on second apply

Cleanup Test

Destroy complete! Resources: 3 destroyed.

PASSED - All resources removed successfully

Version Compatibility

IOS-XE Version Support

IOS-XE Version VPNv4 Support VPNv6 Support test_tags Required
17.12.1 ✅ Yes ✅ Yes ❌ None
17.15.1 ✅ Yes ✅ Yes ❌ None

Verification Method:

  • Searched YANG models in both versions for vpnv4/vpnv6 support
  • Confirmed identical structure in both 17.12.1 and 17.15.1
  • No version-specific test_tags needed

YANG Model Locations:

  • 17.12.1: Cisco-IOS-XE-bgp.yang (lines 5794-5906)
  • 17.15.1: Cisco-IOS-XE-bgp.yang (lines 6042-6154)

Prerequisites

Important: VPNv4 and VPNv6 address families require the BGP router instance to be created first. Use depends_on to ensure proper resource creation order.

resource "iosxe_bgp_address_family_vpnv4" "example" {
  asn     = 65000
  af_name = "unicast"
  depends_on = [iosxe_bgp.example]  # Ensure BGP router exists first
}

Documentation

  • Auto-generated documentation included in docs/ directory
  • Example configurations in examples/ directory
  • Both resources and data sources documented

Checklist

  • Latest commit is rebased from main/master
  • make gen completed successfully
  • go build completed without errors
  • Tested on real IOS-XE device (17.15.01a)
  • Idempotency verified
  • Device CLI verification completed
  • Version compatibility verified (17.12.1 and 17.15.1)
  • Documentation auto-generated
  • No manual comments in YAML files
  • Git commit message follows team standards

Related PRs

Schema and Module PRs will be submitted after this provider PR is merged:

  • Schema PR: TBD (blocked by provider release)
  • Module PR: TBD (blocked by schema merge)

Notes

This is a standard implementation supporting address family creation only.
Future enhancements may include:

  • Neighbor configuration under VPNv4/VPNv6 address families
  • Import/export route target configuration
  • Maximum paths configuration
  • Other VPNv4/VPNv6-specific attributes

The current implementation provides the foundation for L3VPN MPLS VPN routing with BGP control plane.

…rovider

- Add bgp_address_family_vpnv4 resource and data source
- Add bgp_address_family_vpnv6 resource and data source
- Support unicast address family for both VPNv4 and VPNv6
- Tested on IOS-XE 17.15.01a device
- Version compatibility: 17.12.1 and 17.15.1 (no test_tags needed)

Epic #422
@danischm danischm merged commit 5bf21f1 into CiscoDevNet:main Nov 28, 2025
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants