Skip to content

Fix: Cleanup BIRD VRF config (part 1)#3537

Merged
ipspace merged 2 commits into
devfrom
bird-vrf-clean-1
Jun 29, 2026
Merged

Fix: Cleanup BIRD VRF config (part 1)#3537
ipspace merged 2 commits into
devfrom
bird-vrf-clean-1

Conversation

@ipspace

@ipspace ipspace commented Jun 29, 2026

Copy link
Copy Markdown
Owner
  • Create a common per-VRF tagging filter that replaces the per-proto tagging code
  • Add VRF name to VRF routes (that will make inter-VRF route leaking easier)
  • Convert import/export RTs to BIRD syntax in device quirk and use the BIRD-formatted values in Jinja2 templates

* Create a common per-VRF tagging filter that replaces the per-proto
  tagging code
* Add VRF name to VRF routes (that will make inter-VRF route leaking
  easier)
* Convert import/export RTs to BIRD syntax in device quirk and use the
  BIRD-formatted values in Jinja2 templates

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors BIRD VRF configuration generation by centralizing VRF route tagging into a common per-VRF filter, introducing BIRD-formatted import/export route-target tuples produced by a device quirk, and embedding VRF identity into VRF-learned routes to support inter-VRF leaking workflows.

Changes:

  • Add bird_vrf_rt() device quirk to precompute per-VRF _bird_import / _bird_export route-target tuples for use in templates.
  • Introduce per-VRF vrf_<name>_tag filter and netlab_vrf_name attribute, and switch multiple protocols/macros to use the shared filter instead of inline tagging code.
  • Update inter-VRF leaking logic to compare and emit BIRD-formatted route-target tuples.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
netsim/devices/bird.py Adds a quirk to convert VRF import/export RT strings into BIRD tuple syntax for templates.
netsim/daemons/bird/vrf-daemon.j2 Adds netlab_vrf_name and a shared per-VRF tag filter; updates tagging and VRF leaking to use _bird_* RT values.
netsim/daemons/bird/ospf.macros.j2 Switches VRF OSPF protocol instances to use the shared vrf_<name>_tag import filter.
netsim/daemons/bird/bgp.macros.j2 Switches VRF BGP protocol instances to use the shared vrf_<name>_tag import filter.

Comment thread netsim/devices/bird.py Outdated
Comment on lines +19 to +27
'''
The magic of the following line explained for people who don't want to study it ;)

* Iterate over all route targets in the import/export list
* Split the original route target (asn:rt or ip:rt) into its components
* Rejoin the RT components separated by commas (OK, I could have used replace, but this
is way cooler :-P )
* Add (rt,) around the RT components
'''
ipspace added a commit that referenced this pull request Jun 29, 2026
@ipspace ipspace merged commit 096f04a into dev Jun 29, 2026
11 checks passed
@ipspace ipspace deleted the bird-vrf-clean-1 branch June 29, 2026 12:52
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