Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include VRF-assigned child prefixes when viewing a global container prefix #1073

Closed
martink2 opened this issue Apr 12, 2017 · 7 comments
Closed
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@martink2
Copy link

The recent change introduced a behavioral change in the way GLOBAL
prefixes relate to child prefixes in named VRF's.

Before the change sub-prefixes in any VRF were treated as child from the global parent.
After the change only child prefixes from within the same VRF (Global and named) are considered child prefixes.

From a pure technical routing table perspective the global VRF is only normal VRF
without a name. But from a ipam perspective there is a different definition of Global
in the sense of globally unique prefix.

Especially for the type container, which is not a "real" routable entity but a bucket for
organisational purposes the pure routing table interpretation is maybe too strict.
Valid use-cases for globally unique prefixes are buckets for sub-allocations
like Router-ID's or Transit Networks, where the bucket is created to group a larger
range for the purpose of sub-allocating as needed across VRF's while maintaining
an overview of the bucket usage. Another reason
would be BGP-L3VPN route-leaking where prefixes are expected to be present
in multiple VRF's, which should be reflected in the IPAM, since they are not the same
range in different VRF's but truly the same entity in all VRF's.

Except of simply reverting to the old behavior I could imagine the following
approaches to the problem:

  1. Treat type Container and vrf GLOBAL is globally unique as a convention
  2. Introduce a flag on a prefix marking it as globally unique irrespective of the VRF it is defined in
  3. Treat all containers as cross vrf parents

My personal vote would go to 2. As 1. would introduce a major behavioral change based
on an attribute combination for only a single combination of attributes. 3. would remove
the ability to have a container which is on purpose only valid within a given VRF.

@jeremystretch
Copy link
Member

I think you're conflating uniqueness with address space. Whether or not a prefix is unique is dependent entirely upon whether it has been defined multiple times within a table, regardless of how many instances there are of it across different tables.

The concern you brought up in #1067 was that child prefixes in VRFs that are covered by a container prefix in the global table were not being displayed as children. For example, if you had:

  • 10.0.0.0/8 - Global (container)
  • 10.1.0.0/16 - VRF A
  • 10.2.0.0/16 - VRF B
  • 10.3.0.0/16 - VRF C

When you view 10.0.0.0/8, you want to see the children from all VRFs as well, correct? There are inevitably going to be contexts where this is and is not desirable, but I think making the exception for prefixes defined as containers is a good compromise.

@martink2
Copy link
Author

martink2 commented Apr 12, 2017

True maybe i was trying to package too much into a single feature.
Yes my expectation would be that your example would indeed list
10.1/16,10.2/16 and 10.3/16 as child of 10/8.

However to be more precise I would also expect given the following:

  • 10.0.0.0/8 - VRF A (Container)
  • 10.1.0.0/16 - VRF A
  • 10.2.0.0/16 - VRF B
  • 10.3.0.0/16 - VRF A

That a container in Global is encapsulating al sub-prefixes regardless of sub-prefix VRF where as containers belonging to a named VRF is only in relation to sub-prefixes in his own VRF.

  • 10.0.0.0/8
    • 10.1.0.0/16
    • 10.3.0.0/16
  • 10.2.0.0/16

So the point i was trying to make was the question if the combination Global + Container
treated as a special case for child-parent relationship is a desired behavior or
if a separate flag signifying a global uniqueness has an effect on a prefix depending
on the prefix type, example:

Type Container + Flag unique: Shows all sub-prefixes in any VRF as child.
Type not Container + Flag unique: Results in an error if a user is trying to define the same prefix in any other VRF.

For the second example the question would be shall any sub-prefix of a globally unique prefix be automatically treated as globally unique?

For my specific use-case which was affected by the recent change i would be
very happy with the special case container you proposed.

@jeremystretch jeremystretch changed the title Feature Request: Globally unique prefixes Globally unique prefixes Apr 13, 2017
@jeremystretch jeremystretch added the type: feature Introduction of new functionality to the application label Apr 13, 2017
@jeremystretch
Copy link
Member

As I said, this has nothing to do with uniqueness. There's no need to add a flag to the model for this. The question is simply whether to include VRF-assigned prefixes when displaying the children of a container prefix in the global table.

@jeremystretch jeremystretch changed the title Globally unique prefixes Include VRF-assigned child prefixes when viewing a global container prefix Apr 18, 2017
@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label Jan 26, 2018
@martink2
Copy link
Author

Hi @jeremystretch thanks for taking a look into the issue. In the latest version (2.2.9) i can now correctly see all children regardless of the VRF in the child prefixes tab. As far as i can see there
are still two little inconsistencies, although i might be wrong and it is intended behaviour:

  1. in the prefix list the VRF children are still shown as individual prefixes and not children:
    image

  2. The Utilisation of the parent container only counts the utilisation of sub-prefixes in the global VRF

@jeremystretch jeremystretch reopened this Jan 31, 2018
funzoneq added a commit to openfibernet/netbox that referenced this issue Feb 6, 2018
* Fixes netbox-community#1765: Improved rendering of null options for model choice fields in filter forms

* Fixes netbox-community#1802: Typo in ldap.md

* Fixes netbox-community#1621: Tweaked LLDP interface name evaluation logic

* Fixes netbox-community#1807: Populate VRF from parent when creating a new prefix

* Fixes netbox-community#1809: Populate tenant assignment from parent when creating a new prefix

* Closes netbox-community#1824: Add virtual machine count to platforms list

* Fixes netbox-community#1818: InventoryItem API serializer no longer requires specifying a null value for items with no parent

* Evaluate device_id rather than pulling entire device (DB optimization)

* added statement and exaple for using ForeignKey ID's in write actions

* Closes netbox-community#1828: Added warning about media directory permissions

* fixed duplicate api docs example and grammar

* Closes netbox-community#1835: Consistent position of previous/next rack buttons

* Fixes netbox-community#1845: Correct display of VMs in list with no role assigned

* Closes netbox-community#1406: Display tenant description as title text in object tables

* Closes netbox-community#1366: Enable searching for regions by name/slug

* Cleaned up InventoryItem add/edit/delete links and return URL

* Closes netbox-community#1073: Include prefixes/IPs from all VRFs when viewing the children of a container prefix in the global table

* Closes netbox-community#144: Implemented list and bulk edit/delete views for InventoryItems

* Added report results to the home page

* Fixes netbox-community#1850: Fix TypeError when attempting IP address import if only unnamed devices exist

* Added warning message about automatically deleting child inventory items

* Release v.2.2.9
@nikkytub
Copy link

nikkytub commented Feb 8, 2018

Hi @jeremystretch and @martink2 I made some minor changes based on issue-1073 and pushed them recently which you can see here sapcc@a5f6149 It has solved the utilization problem and now prefixes are ordered in the prefix list view on the basis of parent child relationship. Here I wanted to add one more functionality in the Prefix list view which should be similar to what we see once we click on an individual parent prefix which in case of VRF 'Global' and status 'Container' shows all the child prefixes irrespective of their VRF's by taking its primary key. And in case of parent prefix with VRF 'A' and status 'Container' shows only child prefixes associated to that VRF only which is 'A' in this case. I found two ways to implement it either we could make the change in IPAM/querysets.py which is currently using stack.pop() to remove the last element from the list in the while loop which I found a bit cumbersome and I need @jeremystretch advice or either if we could find a way to apply conditional expressions in class Meta in ordering in IPAM/models.py under class Prefix which I couldn't find in Django's documentation. I found we can use 'when' 'then' in filtering the queryset for instance but not inside Class Meta ordering. Please look into the matter. Thanks.

@nbaillie
Copy link

nbaillie commented Apr 30, 2018

Hi, all.
I just started to look using netbox in this way.

Im running version v2.3.3 and looks like its not grouping in the prefix top level page, or doing the utilisation as i would expect.

Might be im trying this all wrong, but wanted to check if this is expected.

screen shot 2018-04-30 at 15 13 47
screen shot 2018-04-30 at 15 14 06

it can see the childs though in Child Prefixes under the prefix.
screen shot 2018-04-30 at 15 14 21

DanSheps added a commit to DanSheps/netbox that referenced this issue Nov 18, 2018
…rdering to allow allow for proper matching of heirarchy for IP address space
@DanSheps
Copy link
Member

DanSheps commented Apr 7, 2020

Going to close this out, discussion can continue under #2562

@DanSheps DanSheps closed this as completed Apr 7, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

5 participants