[TRM] Implement MPLS Label Mode Support in Terraform Provider #385
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
MPLS Label Mode Support
This PR adds support for MPLS Label Mode configuration to the terraform-provider-iosxe.
This enhancement introduces the
iosxe_mplsresource and data source with the ability to configure MPLS label allocation modes. This feature provides network operators with granular control over MPLS label distribution behavior across VRFs and address families, enabling optimized label allocation strategies for service provider MPLS/VPN deployments. MPLS label modes control how labels are allocated and distributed for VPN routes, allowing operators to balance between label efficiency (per-VRF mode using fewer labels) and traffic engineering flexibility (per-prefix mode allowing per-destination control).CLI Commands Supported
MPLS Configuration
mpls label protocol {ldp | tdp}
mpls label mode all-vrfs protocol all-afs {per-vrf | per-prefix | per-ce | vrf-conn-aggr}
mpls label mode all-vrfs protocol bgp-vpnv4 {per-vrf | per-prefix | per-ce | vrf-conn-aggr}
mpls label mode all-vrfs protocol bgp-vpnv6 {per-vrf | per-prefix | per-ce | vrf-conn-aggr}
These commands enable MPLS label allocation control with the following capabilities:
Benefits
Platform Compatibility
These features have been validated against:
Version Requirements
IOS-XE 17.15.1 and later:
label_protocol(String: "ldp" or "tdp") - MPLS label distribution protocollabel_mode_all_vrfs_protocol_all_afs_per_vrf(Boolean) - Per-VRF label mode for all address familieslabel_mode_all_vrfs_protocol_all_afs_per_prefix(Boolean) - Per-prefix label mode for all address familieslabel_mode_all_vrfs_protocol_all_afs_per_ce(Boolean) - Per-CE label mode for all address familieslabel_mode_all_vrfs_protocol_all_afs_vrf_conn_aggr(Boolean) - VRF connected aggregate label mode for all address familieslabel_mode_all_vrfs_protocol_bgp_vpnv4_per_vrf(Boolean) - Per-VRF label mode for BGP VPNv4label_mode_all_vrfs_protocol_bgp_vpnv4_per_prefix(Boolean) - Per-prefix label mode for BGP VPNv4label_mode_all_vrfs_protocol_bgp_vpnv4_per_ce(Boolean) - Per-CE label mode for BGP VPNv4label_mode_all_vrfs_protocol_bgp_vpnv4_vrf_conn_aggr(Boolean) - VRF connected aggregate label mode for BGP VPNv4label_mode_all_vrfs_protocol_bgp_vpnv6_per_vrf(Boolean) - Per-VRF label mode for BGP VPNv6label_mode_all_vrfs_protocol_bgp_vpnv6_per_prefix(Boolean) - Per-prefix label mode for BGP VPNv6label_mode_all_vrfs_protocol_bgp_vpnv6_per_ce(Boolean) - Per-CE label mode for BGP VPNv6label_mode_all_vrfs_protocol_bgp_vpnv6_vrf_conn_aggr(Boolean) - VRF connected aggregate label mode for BGP VPNv6Platform Notes:
Cisco-IOS-XE-mplsYANG model augmented to/native/mplsTechnical Implementation
iosxe_mplsresource with the following attributes:label_protocol(String, Optional) - Label distribution protocol ("ldp" or "tdp")label_mode_all_vrfs_protocol_all_afs_per_vrf(Boolean, Optional) - Per-VRF mode for all AFslabel_mode_all_vrfs_protocol_all_afs_per_prefix(Boolean, Optional) - Per-prefix mode for all AFslabel_mode_all_vrfs_protocol_all_afs_per_ce(Boolean, Optional) - Per-CE mode for all AFslabel_mode_all_vrfs_protocol_all_afs_vrf_conn_aggr(Boolean, Optional) - VRF connected aggregate for all AFslabel_mode_all_vrfs_protocol_bgp_vpnv4_per_vrf(Boolean, Optional) - Per-VRF mode for BGP VPNv4label_mode_all_vrfs_protocol_bgp_vpnv4_per_prefix(Boolean, Optional) - Per-prefix mode for BGP VPNv4label_mode_all_vrfs_protocol_bgp_vpnv4_per_ce(Boolean, Optional) - Per-CE mode for BGP VPNv4label_mode_all_vrfs_protocol_bgp_vpnv4_vrf_conn_aggr(Boolean, Optional) - VRF connected aggregate for BGP VPNv4label_mode_all_vrfs_protocol_bgp_vpnv6_per_vrf(Boolean, Optional) - Per-VRF mode for BGP VPNv6label_mode_all_vrfs_protocol_bgp_vpnv6_per_prefix(Boolean, Optional) - Per-prefix mode for BGP VPNv6label_mode_all_vrfs_protocol_bgp_vpnv6_per_ce(Boolean, Optional) - Per-CE mode for BGP VPNv6label_mode_all_vrfs_protocol_bgp_vpnv6_vrf_conn_aggr(Boolean, Optional) - VRF connected aggregate for BGP VPNv6iosxe_mplsdata source for configuration retrieval/restconf/data/Cisco-IOS-XE-native:native/mplsCisco-IOS-XE-nativeandCisco-IOS-XE-mplsmodulesTesting
Go Acceptance Tests
=== RUN TestAccIosxeMPLS
--- PASS: TestAccIosxeMPLS (2.85s)
PASS
ok github.com/CiscoDevNet/terraform-provider-iosxe/internal/provider 2.856s
Multi-Platform Validation
Network as Code (NaC) Framework Integration Testing
terraform-iosxe-nac-iosxe/iosxe_mpls.tf)Terraform Testing
terraform plan- Correctly identifies MPLS configuration changesterraform apply- Successfully applies MPLS label mode configurationterraform destroy- Cleanly removes MPLS configurationRESTCONF API Validation
Cisco-IOS-XE-mpls:mpls)YANG Model Validation
Cisco-IOS-XE-mpls.yang)config-mpls-groupingaugmented to/native/mplsall-afs,bgp-vpnv4,bgp-vpnv6caseslabel/mode/all-vrfs/protocol/{choice}Example Usage
Example 1: Basic Per-VRF Label Mode (Recommended for label efficiency)