Skip to content

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

@miaow2

Description

@miaow2

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

Metadata

Metadata

Assignees

Labels

complexity: lowRequires minimal effort to implementstatus: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions