Expand search to description and comment fields
It would be great if IPs were searchable by description for implementations with large numbers of IP addresses.
This probably ties int #166
Yes, this would be great!
I just hit this while trying the demo, the search should be really flexible IMHO, almost google like. No matter what you search you should get results in all fields and categories, saving you search in different fields, or making mistakes.
I've expanded the scope of this issue to include all objects.
38aee33df01ccddb35607bebdbfe233f857c78dd added the following fields to the "q" search filter:
- Circuits
- Provider: comments
- Ciruit: comments, pp_info, xconnect_id
- DCIM
- Site: comments
- Rack: comments
- Device: comments
- IPAM
- VRF: RD, description (new filter)
- Aggregate: prefix, description (new filter)
- Prefix: description
- IPAddress: description
- VLAN: VID, name, description (new filter)
- Secrets
- Secret: name, device.name (new filter)
- Tenancy
- Tenant: description, comments
Thanks for adding additional search fields!
We are now using NetBox as a data source for provisioning system. We import server serial numbers and (pre-allocated) IP addresses into NetBox and boot bare-metal servers with PXE (with DHCP temporary IP addresses). A Python script in PXE live system would first collect server serial number (with dmidecode -s system-serial-number) before querying NetBox for permanent IP address of that server for provisioning purpose.
It would be great if serial number could be added as a search field for devices. Thanks!
To be clear, I mean the /api/dcim/devices/ API.
The fields I listed above are just the new additions. Serial has always been included in device search (also the serials of installed modules):
def search(self, queryset, value):
return queryset.filter(
Q(name__icontains=value) |
Q(serial__icontains=value) |
Q(modules__serial__icontains=value) |
Q(comments__icontains=value)
).distinct()
Yes, I know I can generally search for foo and all devices with foo values would be returned in JSON. However, if device A has string foo in comments field and device B has string foo in serial field. Device A and B would both be returned when searching for foo. We had to manually check if foo appears in serial field. It would be nice if we can just search for foo in serial field.