IPAM Address Searching #1197

Closed
opened 2025-12-29 16:29:57 +01:00 by adam · 1 comment
Owner

Originally created by @kopacko on GitHub (Aug 25, 2017).

Issue type

[x] Feature request
[ ] Bug report
[ ] Documentation

Environment

  • Python version:
  • NetBox version:

Description

Would it be possible to allow for searching device types and device names within the scope of IP addresses?

I would like to be able to search for all IP addresses assigned to a device type or in the case of a device with multiple VLANs and whatnot, see what all IP addresses are assigned to a device from the IP address search page.

Originally created by @kopacko on GitHub (Aug 25, 2017). <!-- Before opening a new issue, please search through the existing issues to see if your topic has already been addressed. Note that you may need to remove the "is:open" filter from the search bar to include closed issues. Check the appropriate type for your issue below by placing an x between the brackets. If none of the below apply, please raise your issue for discussion on our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please note that issues which do not fall under any of the below categories will be closed. ---> ### Issue type [x] Feature request <!-- Requesting the implementation of a new feature --> [ ] Bug report <!-- Reporting unexpected or erroneous behavior --> [ ] Documentation <!-- Proposing a modification to the documentation --> <!-- Please describe the environment in which you are running NetBox. (Be sure to verify that you are running the latest stable release of NetBox before submitting a bug report.) --> ### Environment * Python version: <!-- Example: 3.5.4 --> * NetBox version: <!-- Example: 2.1.3 --> <!-- BUG REPORTS must include: * A list of the steps needed to reproduce the bug * A description of the expected behavior * Any relevant error messages (screenshots may also help) FEATURE REQUESTS must include: * A detailed description of the proposed functionality * A use case for the new feature * A rough description of any necessary changes to the database schema * Any relevant third-party libraries which would be needed --> ### Description Would it be possible to allow for searching device types and device names within the scope of IP addresses? I would like to be able to search for all IP addresses assigned to a device type or in the case of a device with multiple VLANs and whatnot, see what all IP addresses are assigned to a device from the IP address search page.
adam closed this issue 2025-12-29 16:29:57 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 25, 2017):

This isn't something we'd implement a built-in filter for because it spans too many relationships. However you can achieve this easily using the command shell:

$ ./manage.py nbshell
### NetBox interactive shell (jstretch-laptop)
### Python 3.4.3 | Django 1.11.4 | NetBox 2.1.4-dev
### lsmodels() will show available models. Use help(<model>) for more info.
>>> device_type = DeviceType.objects.get(manufacturer__slug='juniper', model='EX4300-48T')
>>> ip_addresses = IPAddress.objects.filter(interface__device__device_type=device_type)
>>> for ip in ip_addresses:
...   print(ip)
... 
10.1.0.2/24
10.1.0.3/24
10.1.0.4/24
...
@jeremystretch commented on GitHub (Aug 25, 2017): This isn't something we'd implement a built-in filter for because it spans too many relationships. However you can achieve this easily using the command shell: ``` $ ./manage.py nbshell ### NetBox interactive shell (jstretch-laptop) ### Python 3.4.3 | Django 1.11.4 | NetBox 2.1.4-dev ### lsmodels() will show available models. Use help(<model>) for more info. >>> device_type = DeviceType.objects.get(manufacturer__slug='juniper', model='EX4300-48T') >>> ip_addresses = IPAddress.objects.filter(interface__device__device_type=device_type) >>> for ip in ip_addresses: ... print(ip) ... 10.1.0.2/24 10.1.0.3/24 10.1.0.4/24 ... ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1197