Filtering cables by terminations in the API returns wrong results #10615
Labels
status: accepted
This issue has been accepted for implementation
type: bug
A confirmed report of unexpected behavior in the application
NetBox version
v3.3.5
Python version
3.10
Steps to Reproduce
We discussed this on slack. Reproduction steps will be a little lackluster, but if needed I'll try to improve them.
dcim.interface
and the id 999.https://netboxurl/api/dcim/cables/?termination_b_type=dcim.interface&termination_b_id=999
Expected Behavior
The API request should match any cables where one of the terminations has an id of 999 and the type
dcim.interface
.Observed Behavior
A cable where one of the terminations is of type dcim.frontport and the id is 999.
The generated SQL looks like this:
The issue is that id and content type is matches independently, so if just one of the terminations is of the type dcim.interface it matches, regardless if that was the termination with the correct ID.
termination_b_type/termination_b_id and termination_a_type/termination_a_id also matches the same thing, not sure if this is intended and the a/b end are just for ease of visualization.
The text was updated successfully, but these errors were encountered: