Skip to content

Prefix in different VRF wrongly sees global prefix as its parent #11715

@candlerb

Description

@candlerb

NetBox version

v3.4.4

Python version

3.8

Steps to Reproduce

  1. Create VRF "testvrf"
  2. Create prefix 192.168.0.0/24 in global VRF
  3. Create prefix 192.168.0.0/28 in "testvrf"
  4. Browse to 192.168.0.0/28 (which is where you'll be right after creation)

Expected Behavior

192.168.0.0/28@testvrf and 192.168.0.0/24 should be independent from each other, as they are in different VRFs.

Observed Behavior

192.168.0.0/28@testvrf sees 192.168.0.0/24 as its parent.

image

However, 192.168.0.0/24 does not see 192.168.0.0/28@testvrf as its child.

This is inconsistent: this child<->parent relationship should either work in both ways, or neither.

In this case, I think it should be neither: otherwise 192.168.0.0/24 could see many different prefixes and IP addresses in different VRFs as its children, which would mix lots of VRFs together in the same view.

EDIT: the current behaviour does appear to be intentional in the code:

        # Parent prefixes table
        parent_prefixes = Prefix.objects.restrict(request.user, 'view').filter(
            Q(vrf=instance.vrf) | Q(vrf__isnull=True)

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions