API created sites duplicated in search results (both GUI and API) #6554

Closed
opened 2025-12-29 19:42:16 +01:00 by adam · 4 comments
Owner

Originally created by @zacho112 on GitHub (Jun 10, 2022).

Originally assigned to: @kkthxbye-code on GitHub.

NetBox version

v3.2.3

Python version

3.9

Steps to Reproduce

  • Create RIR
  • Create two ASNs 123 & 1234
  • Create site test123 with both ASNs assigned
  • Search for Sites with the q value "123"

Expected Behavior

Only showing one result for the site

Observed Behavior

Duplicate site referring to the same site id.

Originally created by @zacho112 on GitHub (Jun 10, 2022). Originally assigned to: @kkthxbye-code on GitHub. ### NetBox version v3.2.3 ### Python version 3.9 ### Steps to Reproduce * Create RIR * Create two ASNs 123 & 1234 * Create site test123 with both ASNs assigned * Search for Sites with the q value "123" ### Expected Behavior Only showing one result for the site ### Observed Behavior Duplicate site referring to the same site id.
adam added the type: bugstatus: accepted labels 2025-12-29 19:42:16 +01:00
adam closed this issue 2025-12-29 19:42:17 +01:00
Author
Owner

@zacho112 commented on GitHub (Jun 10, 2022):

We have 3 different setups (dev/qa/prod), all using the docker version, all having the exact same issue

@zacho112 commented on GitHub (Jun 10, 2022): We have 3 different setups (dev/qa/prod), all using the docker version, all having the exact same issue
Author
Owner

@kkthxbye-code commented on GitHub (Jun 10, 2022):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.2.4. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

Creating two sites in pynetbox like this:

nb.dcim.sites.create(name="703-Site1", slug="703-Site1", status="planned")
nb.dcim.sites.create(name="703-Site2", slug="703-Site2", status="planned")

And searching with /api/dcim/sites/?q=703&obj_type= did not return multiple of the same site.

@kkthxbye-code commented on GitHub (Jun 10, 2022): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.2.4. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data. Creating two sites in pynetbox like this: ``` nb.dcim.sites.create(name="703-Site1", slug="703-Site1", status="planned") nb.dcim.sites.create(name="703-Site2", slug="703-Site2", status="planned") ``` And searching with `/api/dcim/sites/?q=703&obj_type=` did not return multiple of the same site.
Author
Owner

@jeremystretch commented on GitHub (Jun 10, 2022):

Please also note that for us to accept the bug report, it needs to include reproduction steps using raw API requests (not using the pynetbox client, which may introduce bugs outside our control).

@jeremystretch commented on GitHub (Jun 10, 2022): Please also note that for us to accept the bug report, it needs to include reproduction steps using raw API requests (not using the pynetbox client, which may introduce bugs outside our control).
Author
Owner

@zacho112 commented on GitHub (Jun 12, 2022):

It's related to the new ASN model, if you have more than one AS number attached to a site, it'll show up mulitple times in search. I reproduced the issue on demo.netbox.dev: https://demo.netbox.dev/search/?q=840&obj_type=

Just create a site, and attach more than one AS number, the amount of AS' attached is the same as the amount of times the site shows up in the search results.

In this case the naming standard is ABC-xxx-NAME (xxx = int), and if I search for "xxx", or "-xxx", the site will show up multiple times, if there's ASN' attached.

Search with problem: https://demo.netbox.dev/search/?q=840&obj_type=
Search with problem: https://demo.netbox.dev/search/?q=-840&obj_type=
Search with correct results: https://demo.netbox.dev/search/?q=GBR-840&obj_type=
Search with correct results: https://demo.netbox.dev/search/?q=840-&obj_type=

@zacho112 commented on GitHub (Jun 12, 2022): It's related to the new ASN model, if you have more than one AS number attached to a site, it'll show up mulitple times in search. I reproduced the issue on demo.netbox.dev: https://demo.netbox.dev/search/?q=840&obj_type= Just create a site, and attach more than one AS number, the amount of AS' attached is the same as the amount of times the site shows up in the search results. In this case the naming standard is ABC-xxx-NAME (xxx = int), and if I search for "xxx", or "-xxx", the site will show up multiple times, if there's ASN' attached. Search with problem: https://demo.netbox.dev/search/?q=840&obj_type= Search with problem: https://demo.netbox.dev/search/?q=-840&obj_type= Search with correct results: https://demo.netbox.dev/search/?q=GBR-840&obj_type= Search with correct results: https://demo.netbox.dev/search/?q=840-&obj_type=
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6554