Expose /api/ipam/prefixes/<prefixid>/ip-ranges/ - Used as web view - not in API #8649

Closed
opened 2025-12-29 20:39:18 +01:00 by adam · 2 comments
Owner

Originally created by @flohoff on GitHub (Sep 19, 2023).

NetBox version

v3.6.1

Feature type

New functionality

Proposed functionality

Mapping from prefixes to ip-ranges or vice versa is pretty hard. In 3.5.7 the extension to use "parent=" was added but imho this ignores the possibility of vrf mismatch.

The Webui uses the view uri /ipam/prefixes/<prefixid>/ip-ranges/ which in the controller matches prefix and vrf.

I'd wish this to be exported as an API call aswell analog to:

    'ip-ranges/<int:pk>/available-ips/', 
    'prefixes/<int:pk>/available-prefixes/',  
    'prefixes/<int:pk>/available-ips/', 
    'vlan-groups/<int:pk>/available-vlans/', 

Another good option would be /ipam/ip-ranges/?prefixid=<prefixid> but as the ranges dont have a link to prefixes per se the former is easier as the code is already there, just needs to be copied from ipam/views.py to ipam/api/views.py

Flo

Use case

Getting all ranges in a prefix matching prefix and vrf.

Database changes

None

External dependencies

None

Originally created by @flohoff on GitHub (Sep 19, 2023). ### NetBox version v3.6.1 ### Feature type New functionality ### Proposed functionality Mapping from prefixes to ip-ranges or vice versa is pretty hard. In 3.5.7 the extension to use "parent=<prefix>" was added but imho this ignores the possibility of vrf mismatch. The Webui uses the view uri **/ipam/prefixes/\<prefixid\>/ip-ranges/** which in the controller matches prefix and vrf. I'd wish this to be exported as an API call aswell analog to: 'ip-ranges/<int:pk>/available-ips/', 'prefixes/<int:pk>/available-prefixes/', 'prefixes/<int:pk>/available-ips/', 'vlan-groups/<int:pk>/available-vlans/', Another good option would be **/ipam/ip-ranges/?prefixid=\<prefixid\>** but as the ranges dont have a link to prefixes per se the former is easier as the code is already there, just needs to be copied from ipam/views.py to ipam/api/views.py Flo ### Use case Getting all ranges in a prefix matching prefix and vrf. ### Database changes None ### External dependencies None
adam added the type: featurepending closure labels 2025-12-29 20:39:18 +01:00
adam closed this issue 2025-12-29 20:39:18 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 19, 2023):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Dec 19, 2023): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Jan 18, 2024):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Jan 18, 2024): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8649