Inherit VRF from parent prefix when reserving IP addresses - #614
Inherit VRF from parent prefix when reserving IP addresses#614anguswilliams wants to merge 1 commit into
Conversation
IpAddressClaim previously created IP addresses with no VRF set, so they didn't show up nested under a parent prefix that has a non-global VRF in NetBox. NetBox's available-ips response already carries the prefix's VRF; thread it through into the WritableIPAddress sent on create, and preserve the existing VRF on update since it's a full PUT. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Hey @jstudler I noticed you were taking a look at #515 so tagging you in here, apologies if you're not the right person. I have an issue where VRF is set on a prefix in my netbox instance, the operator will find an available IP in that prefix (first prefix matching the specified CIDR), but then creates the IP in the global VRF (default when VRF is set to nil) which means the newly created IP has no parent prefix. This change fixes this to set the VRF to match the prefix it found when creating the new IP, which is the correct behaviour, as you can only guarantee the IP is available on the matched prefix. This is only half the story however as the default behaviour is just to find grab the first prefix matched by the given CIDR, which won't work if the same cidr was used over multiple VRFs. I do wonder if #515 is a better approach but a bigger change, I only noticed it after adding this MR. Just gauging your interest in merging either of these? Happy to pickup MR 515 and rebase if you would prefer that approach. |
|
Hey @anguswilliams |
IpAddressClaim previously created IP addresses with no VRF set, so they didn't show up nested under a parent prefix that has a non-global VRF in NetBox. NetBox's available-ips response already carries the prefix's VRF; thread it through into the WritableIPAddress sent on create, and preserve the existing VRF on update since it's a full PUT.