Skip to content

Conversation

@tech-of-all-trades
Copy link
Contributor

This PR extends the Terraform module to support PIM advanced configuration.

Extended the iosxe_pim resource with register-source configuration support for both
global and VRF-specific contexts, enabling PIM register message source interface
specification.

New Attributes (2 total):
- Global PIM configuration:
  - register_source_loopback: Conditionally set based on register_source_interface_type
    and register_source_interface_id with three-level fallback (device config → defaults → null)

- VRF PIM configuration (within vrfs list):
  - register_source_loopback: Conditionally set based on VRF register_source_interface_type
    and register_source_interface_id with three-level fallback (VRF config → defaults → null)

Implementation Details:
- For consistency, follows the same pattern as the existing bsr_candidate_loopback pattern
- Uses conditional logic: interface_type == "Loopback" ? interface_id : null
- Implements proper try() fallback chain for graceful degradation
- Maintains alignment and formatting with existing attributes
- Supports template variable substitution via schema validation

Pre-Commit Configuration:
- Updated .pre-commit-config.yaml to include terraform-docs hook for new PIM example
- Ensures documentation auto-generation for examples/pim/ directory
- Maintains consistency with existing example documentation workflow

CLI Commands Supported:
- ip pim register-source Loopback<number>
- ip pim vrf <vrf_name> register-source Loopback<number>

Note: SSM range configuration (ssm_range, ssm_default) was already supported for both
global and VRF contexts and has been verified as part of this enhancement.

Files Modified:
- iosxe_pim.tf
- .pre-commit-config.yaml
…e and SSM range

Created a complete PIM example demonstrating advanced multicast configuration including
register-source interface specification and SSM range configuration for both global and
VRF-specific contexts.

Example Features:
- Global PIM register-source configuration using Loopback101
- VRF-specific PIM register-source configuration using Loopback201
- SSM range configuration with ACL references (global: "10", VRF: "20")
- Auto-RP configuration (global and VRF-specific)
- RP address configuration for rendezvous point setup
- Complete prerequisite configuration (system multicast routing, VRF, interfaces)
- PIM sparse-mode enabled on Loopback interfaces

Configuration Demonstrates:
- Proper dependency chain: System → VRF → Interfaces → PIM
- Realistic multi-VRF multicast deployment scenario
- Interface separation for global vs VRF register sources
- Different SSM ACLs for traffic isolation between contexts
- Production-ready configuration patterns

CLI Commands Demonstrated:
- ip multicast-routing
- ip pim register-source Loopback101
- ip pim ssm range 10
- ip pim vrf MULTICAST_VRF register-source Loopback201
- ip pim vrf MULTICAST_VRF ssm range 20

Files Added:
- examples/pim/
- examples/pim/pim.nac.yaml
- examples/pim/main.tf
- examples/pim/versions.tf
- examples/pim/.terraform-docs.yml
- examples/pim/README.md (auto-generated via 'pre-commit run --all-files')

Benefits:
- Provides clear reference implementation for PIM advanced features
- Demonstrates best practices for multicast configuration
- Shows proper VRF isolation for multicast traffic
- Enables users to quickly adopt register-source optimization
- Follows terraform-iosxe-nac-iosxe example conventions
@aitestino aitestino added the enhancement New feature or request label Dec 7, 2025
@aitestino aitestino self-requested a review December 7, 2025 21:52
Changed register_source_loopback to register_source_interface_loopback
to match the terraform-provider-iosxe attribute name.
@aitestino
Copy link
Contributor

Hey Blake, I reviewed this PR and found a small issue - the provider attribute is named register_source_interface_loopback (not register_source_loopback). I've pushed a fix to your branch that corrects this in both the global and VRF sections of iosxe_pim.tf. Also merged main into your branch to keep it current.

Per the module contribution guidelines, individual feature examples
are not required. The examples/system directory serves as the general
usage example for the module.
@aitestino
Copy link
Contributor

Also removed the examples/pim/ directory and the pre-commit config change - per the module contribution guidelines, individual feature examples aren't required. The examples/system/ directory serves as the general usage example for the entire module.

@aitestino aitestino merged commit eeccb51 into netascode:main Dec 7, 2025
1 check passed
@tech-of-all-trades
Copy link
Contributor Author

Hey Blake, I reviewed this PR and found a small issue - the provider attribute is named register_source_interface_loopback (not register_source_loopback). I've pushed a fix to your branch that corrects this in both the global and VRF sections of iosxe_pim.tf. Also merged main into your branch to keep it current.

Thank you for reviewing this Andrea (and for the fix!) -- I'll be sure to check for any mismatches in future contributions.

Also removed the examples/pim/ directory and the pre-commit config change - per the module contribution guidelines, individual feature examples aren't required. The examples/system/ directory serves as the general usage example for the entire module.

Apologies for the extra work, but thank you for making the changes. I'll review the guidelines and refrain from creating these files in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants