Fix: Cleanup BIRD VRF config (part 1)#3537
Merged
Merged
Conversation
ipspace
commented
Jun 29, 2026
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
Contributor
There was a problem hiding this comment.
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_exportroute-target tuples for use in templates. - Introduce per-VRF
vrf_<name>_tagfilter andnetlab_vrf_nameattribute, 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 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
added a commit
that referenced
this pull request
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.