Skip to content

Allow VirtualMachine and Device filter by IP address from Primary IP #19110

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

Closed
miaow2 opened this issue Apr 8, 2025 · 1 comment · Fixed by #19160
Closed

Allow VirtualMachine and Device filter by IP address from Primary IP #19110

miaow2 opened this issue Apr 8, 2025 · 1 comment · Fixed by #19160
Assignees
Labels
complexity: low Requires minimal effort to implement status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Milestone

Comments

@miaow2
Copy link
Contributor

miaow2 commented Apr 8, 2025

NetBox version

v4.2.6

Feature type

New functionality

Proposed functionality

Add primary_ip4 and primary_ip6 filters to ipam.filtersets.PrimaryIPFilterSet

Use case

In our use cases we need to get virtual machine or device by their primary IP. Now we do this in two requests:

  1. find IP address id by api/ipam/ip-addresses/?address=1.1.1.1/32
  2. find device or VM by filtering api/dcim/devices/?primary_ip4_id=<ip_id>

I propose to add filtering by IP address directly, so users can do it only in one request: api/dcim/devices/?primary_ip4=1.1.1.1/32. This will decrease the number of requests and time to complete.

If the issue is accepted, I would be glad to submit a PR.

Database changes

None

External dependencies

None

@miaow2 miaow2 added status: needs triage This issue is awaiting triage by a maintainer type: feature Introduction of new functionality to the application labels Apr 8, 2025
@bctiemann bctiemann added status: accepted This issue has been accepted for implementation complexity: low Requires minimal effort to implement and removed status: needs triage This issue is awaiting triage by a maintainer labels Apr 8, 2025
@bctiemann
Copy link
Contributor

This sounds like a good add. Thanks @miaow2 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: low Requires minimal effort to implement status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants