VRF modyfication on Prefix level does not set VRF for associated IP addresses #4095

Closed
opened 2025-12-29 18:33:05 +01:00 by adam · 3 comments
Owner

Originally created by @azdolinski on GitHub (Sep 11, 2020).

Environment

  • Python version: 3.6.8
  • NetBox version: 2.9.2

Steps to Reproduce

  1. Create VLAN
    image

  2. To this VLAN I assign 1 prefix: 192.168.9.0/24 – where inside I define 2 addresses:
    image
    image

  3. What I would like to do now.. is to move this prefix to VRF..
    So I edit Prefix… select VRF..
    And just after that - prefix shows assigned VRF - but all IPs assigned before to this Prefix are missing.. -> check Observed Behavior

Expected Behavior

I would expect that when I edit Prefix (change VRF)… also this VRF would be set on all associated IP addresses.

Observed Behavior

Prefix has VRF
image
Addresses which before were associated with this prefix - are still in Global VRF
image

Originally created by @azdolinski on GitHub (Sep 11, 2020). ### Environment * Python version: 3.6.8 * NetBox version: 2.9.2 ### Steps to Reproduce 1. Create VLAN ![image](https://user-images.githubusercontent.com/15941777/92825756-31a70d00-f3d0-11ea-8f01-2ccb7e7c826e.png) 2. To this VLAN I assign 1 prefix: 192.168.9.0/24 – where inside I define 2 addresses: ![image](https://user-images.githubusercontent.com/15941777/92825803-3e2b6580-f3d0-11ea-81e4-e8926c10a9d9.png) ![image](https://user-images.githubusercontent.com/15941777/92825841-4aafbe00-f3d0-11ea-9978-af62f9743b53.png) 3. What I would like to do now.. is to move this prefix to VRF.. So I edit Prefix… select VRF.. And just after that - prefix shows assigned VRF - but all IPs assigned before to this Prefix are missing.. -> check Observed Behavior ### Expected Behavior I would expect that when I edit Prefix (change VRF)… also this VRF would be set on all associated IP addresses. ### Observed Behavior Prefix has VRF ![image](https://user-images.githubusercontent.com/15941777/92825936-6a46e680-f3d0-11ea-9176-24eb69095338.png) Addresses which before were associated with this prefix - are still in Global VRF ![image](https://user-images.githubusercontent.com/15941777/92825946-6ca94080-f3d0-11ea-91cb-1802b5bc3d12.png)
adam closed this issue 2025-12-29 18:33:05 +01:00
Author
Owner

@sdktr commented on GitHub (Sep 11, 2020):

VRF assignment, as well as a lot of other relations (tenant/site etc) are directly coupled to the different entities.
Inheritance in your case would be a opiniated guess at best. It is perfectly valid to have 'a' prefix in VRF A and child prefixes or IP's that could hang of it but are actually in another VRF.

Note that there's no direct relation between prefixes (childs/parents) and IP's. Their relation is calculated based on the prefix/subnet length AND VRF.

@sdktr commented on GitHub (Sep 11, 2020): VRF assignment, as well as a lot of other relations (tenant/site etc) are directly coupled to the different entities. Inheritance in your case would be a opiniated guess at best. It is perfectly valid to have 'a' prefix in VRF A and child prefixes or IP's that could hang of it but are actually in another VRF. Note that there's no direct relation between prefixes (childs/parents) and IP's. Their relation is calculated based on the prefix/subnet length AND VRF.
Author
Owner

@azdolinski commented on GitHub (Sep 14, 2020):

It is perfectly valid to have 'a' prefix in VRF A and child prefixes or IP's that could hang of it but are actually in another VRF.

This is not a problem if something is valid... this is problem which cause inconsistency in data inside Netbox from an operational point of view. As we have relation "calculated" between Prefixes and IPs - Im still expect that change one of element (Prefix) will not cause breaks of full chain of connection with those 2 IPs as in example (so all IPs needs to be updated in table 'ipam_ipaddress' with new 'vrf_id' which will cause that after refresh page with prefix.. we will still see those same 2 IPs via 'IP Addresses' tab)

Their relation is calculated based on the prefix/subnet length AND VRF.

Exactly - and when you have some IPs created in Prefix in some VRF (not only Global) - so if you move Prefix to different VRF - also those IPs should be moved - that is my expectation - otherwise, we have a relationship problem - and we have a total mess (prefixes live their own lives, and the belonging IPs live their own).

@azdolinski commented on GitHub (Sep 14, 2020): > It is perfectly valid to have 'a' prefix in VRF A and child prefixes or IP's that could hang of it but are actually in another VRF. This is not a problem if something is valid... this is problem which cause inconsistency in data inside Netbox from an operational point of view. As we have relation "calculated" between Prefixes and IPs - Im still expect that change one of element (Prefix) will not cause breaks of full chain of connection with those 2 IPs as in example (so all IPs needs to be updated in table 'ipam_ipaddress' with new 'vrf_id' which will cause that after refresh page with prefix.. we will still see those same 2 IPs via 'IP Addresses' tab) > Their relation is calculated based on the prefix/subnet length AND VRF. Exactly - and when you have some IPs created in Prefix in some VRF (not only Global) - so if you move Prefix to different VRF - also those IPs should be moved - that is my expectation - otherwise, we have a relationship problem - and we have a total mess (prefixes live their own lives, and the belonging IPs live their own).
Author
Owner

@jeremystretch commented on GitHub (Sep 14, 2020):

As @sdktr points out, this is intended behavior. NetBox does not make assumptions on behalf of the user: you simply need to reassign both the parent prefix and the IP addresses to the new VRF.

@jeremystretch commented on GitHub (Sep 14, 2020): As @sdktr points out, this is intended behavior. NetBox does not make assumptions on behalf of the user: you simply need to reassign both the parent prefix _and_ the IP addresses to the new VRF.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4095