fix(neutron-understack): VNI allocation behaviors#2160
Merged
Conversation
Refactor the decision to allocate a VNI for a router to the service profile metainfo. This allows us to utilize the same VRF plugin code for both the static and the dynamic VRF. Write up some documentation to go along with this behavior and wire in some testing.
cardoe
enabled auto-merge
July 22, 2026 18:47
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.
Summary
Fixes VNI (VXLAN Network Identifier) allocation for routers so that VNIs are only allocated for flavors that actually want them, rather than for every router. This revisits a review comment @skrobul made on #2109 and closes the over-allocation leak introduced there.
Problem
Two issues caused every router — including non-VRF flavors like Palo Alto and Cisco ASA — to silently receive a VNI:
evpn_vnirouter attribute defaulted to0. Neutron core reads0as an auto-allocate request, so a barerouter createtriggered a VNI allocation.Vrf. This is too coarse — it can't distinguish the "admin supplies a VNI" case from the "auto-allocate from a pool" case, and it can't cleanly opt other flavors out.Changes
do not always allocate VNIs for all routersevpn_vniattribute default from0toATTR_NOT_SPECIFIED, so a barerouter createno longer causes Neutron core to auto-allocate a VNI.add VNI allocation flag to VNI service pluginvni_allockey in the flavor's service-profile metainfo instead of from the provider driver name. Three modes:off(default) — never allocate; reject an explicitly suppliedevpn_vni.on— allocate only an explicitly supplied VNI (used bystatic_vrf).auto— auto-allocate from the pool when none is supplied (used bydynamic_vrf).dynamic_vrfandstatic_vrfshare the sameVrfprovider driver while differing only in service-profile metainfo. Any flavor with no metainfo, an invalid value, or no flavor at all safely defaults tooff.off.vni_alloctoggle, the auto-allocation pool ([understack_vni] vni_ranges), configuration/migration steps, and troubleshooting.Testing
test_understack_vni.pyto cover all three modes (with and without a supplied VNI), missing metainfo, no flavor, invalid mode, and theATTR_NOT_SPECIFIEDdefault guard.Notes / migration
vni_alloclives on the service profile, not the flavor. Becausedynamic_vrfandstatic_vrfneed different values, they must be bound to separate service profiles even though both use theVrfdriver — see the operator guide for the rebind steps.