Open tgoodsell-tempus opened 4 months ago
Depending on if this idea is accepted, I would be willing to volunteer for implementation work.
@tgoodsell-tempus good suggestion, there are some technical challenges behind it as it would be semi-blocked by #7845 would probably be done as part of that feature work.
NetBox version
v4.0.3
Feature type
Data model extension
Proposed functionality
Add a
parent_prefix_id
field to the Prefix API object which is populated with the ID value of the Parent Prefix object if it exists. This means the value would only be populated if this is a child of an actual created Prefix within the same VRF. Value would only be the direct parent (depth - 1 in the tree) value.Use case
Currently, when you do a
GET
on a Prefix, you'll receive thechildren
and_depth
fields which help indicate where the Prefix is amongst a tier of next prefixes. However, you still must leverage a separate search function to find the particular parent prefix, when doing the API ops.Adding this field would allow us to avoid needing to implement that search logic, which would be important for API clients performing Prefix management leveraging the hierarchical functions and the available prefix API.
Database changes
TBD: My first thought would be to add this onto the mechanism which populates
_depth
itself, just taking the ID of the_depth - 1
Prefix and adding that to the model via populating the new field. Otherwise we can leave the field asnull
.External dependencies
No response