Skip to content

Conversation

@tech-of-all-trades
Copy link
Contributor

@tech-of-all-trades tech-of-all-trades commented Nov 3, 2025

This PR adds support for additional flow configuration in the terraform-provider-iosxe.

These improvements enhance the iosxe_flow_record and iosxe_flow_exporter resources with comprehensive flow configuration capabilities including enhanced datalink layer matching, IPv4 TTL-based flow tracking, and flexible source interface selection for flow exporters.


CLI Commands Supported

flow record Support

flow record <name>
  match datalink mac source address input
  match datalink mac destination address input
  match datalink vlan input  # Available on Switch platforms (C9K)
  match datalink source-vlan-id  # Available on Router platforms (C8K, CSR1K)
  match datalink destination-vlan-id  # Available on Router platforms (C8K, CSR1K)
  match ipv4 ttl

flow exporter Support

flow exporter <name>
  source <interface>

Supported source interface types include: GigabitEthernet, TwoGigabitEthernet, FiveGigabitEthernet, TenGigabitEthernet, TwentyFiveGigE, FortyGigabitEthernet, HundredGigE, Vlan, Port-channel, and Loopback interfaces.

Benefits:

  • Enables comprehensive Layer 2 flow visibility for operational traffic analysis and security monitoring through MAC address and VLAN tracking
  • Supports TTL-based flow classification to enhance network troubleshooting and identify routing anomalies
  • Provides flexible flow exporter source interface configuration across diverse network topologies and hardware platforms
  • Enhances cross-platform compatibility with intelligent handling of platform-specific syntax differences between Catalyst switch and router platforms

Platform Compatibility:
This PR includes platform-aware attribute handling, ensuring seamless operation across both Catalyst 9000 series switches and Catalyst 8000/CSR1000v router platforms. The provider automatically uses the appropriate YANG paths for each platform type.

…ort to flow resource

Enhanced the iosxe_flow resource with 6 `flow record` and 9 `flow exporter` attributes
to support 9 "flow" cli configuration capabilities.

Note, support for 2 additional `flow record` cli configurations that were not originally
requested have been added and are now supported. This decision was a result of cli
command acceptance that varies based on platform. The solution implemented leverages
"test_tags" to accurately test provider code.

New Attributes (15 total):
- flow_record:
  - match/datalink/mac/source/address/input
  - match/datalink/mac/destination/address/input
  - match/datalink/vlan  <-- Note: Available on switch platforms (C9K) using 'test_tags': [C9000V]
  - match/datalink/source-vlan-id  <-- Note: Available on router platforms (C8K, CSR1K) using 'test_tags': [C8000V]
  - match/datalink/destination-vlan-id  <-- Note: Available on router platforms (C8K, CSR1K) using 'test_tags': [C8000V]
  - match/ipv4/ttl
- flow exporter <name>:
  - source/interface-choice/GigabitEthernet/GigabitEthernet
  - source/interface-choice/TwoGigabitEthernet/TwoGigabitEthernet
  - source/interface-choice/FiveGigabitEthernet/FiveGigabitEthernet
  - source/interface-choice/TenGigabitEthernet/TenGigabitEthernet
  - source/interface-choice/TwentyFiveGigE/TwentyFiveGigE
  - source/interface-choice/FortyGigabitEthernet/FortyGigabitEthernet
  - source/interface-choice/HundredGigE/HundredGigE
  - source/interface-choice/Vlan/Vlan
  - source/interface-choice/Port-channel/Port-channel

CLI Commands Supported (9 total):
- flow record <name>:
  - match datalink mac source address input
  - match datalink mac source address input
  - match datalink vlan input
  - match datalink source-vlan-id
  - match datalink destination-vlan-id
  - match ipv4 ttl
- flow exporter <name>:
  - source <interface>

Files Modified:
- gen/definitions/flow_record.yaml
- gen/definitions/flow_exporter.yaml
- docs/data-sources/flow_exporter.md
- docs/data-sources/flow_record.md
- docs/resources/flow_exporter.md
- docs/resources/flow_record.md
- examples/resources/iosxe_flow_record/resource.tf
- internal/provider/data_source_iosxe_flow_exporter.go
- internal/provider/data_source_iosxe_flow_record.go
- internal/provider/data_source_iosxe_flow_record_test.go
- internal/provider/model_iosxe_flow_exporter.go
- internal/provider/model_iosxe_flow_record.go
- internal/provider/resource_iosxe_flow_exporter.go
- internal/provider/resource_iosxe_flow_record.go
- internal/provider/resource_iosxe_flow_record_test.go
example: 0/0/1
- yang_name: source/interface-choice/TwentyFiveGigE/TwentyFiveGigE
xpath: source/TwentyFiveGigE
tf_name: source_twenty_five_gig_e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we did not abbreviate this with "gig_e" in other instances. Please align this with other interface type references.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that. Corrections have been made to both this and the source_hundred_gig_e names in a9a87aa

Renamed tf_name attributes in flow_exporter.yaml to align with
other interface type references, improving clarity and consistency.

- Updated 'source_twenty_five_gig_e' to 'source_twenty_five_gigabit_ethernet'
- Updated 'source_hundred_gig_e' to 'source_hundred_gigabit_ethernet'.
Renamed attributes in the flow exporter documentation and code, improving
clarity and maintaining consistency across the interface types.

- Updated 'source_hundred_gig_e' to 'source_hundred_gigabit_ethernet'
- Updated 'source_twenty_five_gig_e' to 'source_twenty_five_gigabit_ethernet'
@aitestino aitestino added the enhancement New feature or request label Nov 9, 2025
@danischm danischm merged commit bb30cf8 into CiscoDevNet:main Nov 9, 2025
3 checks passed
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