-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected results from query GET /api/dcim/cables/ with termination_a_id and termination_a_type query parameters #14274
Comments
Issue discovered when querying for existing cables and got back confusing results about a connection between different locations and between unexpected device types for a front port that appeared to have no connection when viewed in netbox |
I can confirm this, and it's a duplicate of this issue: I never followed up as so much time passed, but it seem like the PR fixed this extra note in the issue instead of the actual issue:
|
I saw that issue but did not realize it was the same, my mistake. If this ends up not being a valid issue, for any future viewers, my team is working around this issue by filtering the filtered results: Step 1: query for termination_a_id = 5 and termination_a_type = dcim.frontport Maybe a comment should be added to the original issue, but I would most certainly think this is an issue. The circumstance in which we discovered the behavior suggests so to me, at least. We asked for specifics on one end of a potentially existing cable and got results for a mix of both ends of a different cable. If asking for termination_a_id = 5 and termination_a_type = dcim.frontport yields the same cable as:
Surely that is undesirable behavior |
Rather than attempt to fix the current logic, it would probably be easier and provide for a better user experience to implement an alternative set of filters for cables. I've opened FR #14434 to propose this, and will mark this as blocked pending the outcome of that discussion. |
Following up on the above, #14434 has been completed and will be included in the v3.7.0 release. IMO these new filters offer a much more convenient means of filtering cables by a specific termination object. |
@jeremystretch can this be closed then as resolved in 3.7? Also #10615 |
I think so. Just to drive this home, the above example
would become
I'm going to close this out as there's been no further discussion and IMO the root use case is satisfied by the new filters. Thanks for calling that out @arthanson. |
NetBox version
v3.6.5
Python version
3.10
Steps to Reproduce
GET /api/dcim/cables/?termination_a_id=2&termination_a_type=dcim.frontport
Expected Behavior
No cable - in this scenario, front port 2 belonging to device 1 has no cable. Front port 20 belonging to device 2 has a cable to interface 2.
Observed Behavior
The query asks for termination_a_id=2 and termination_a_type=dcim.frontport but returns a cable where termination_a_id=2 and termination_b_type=dcim.frontport
Have also tested this with rear cables. A matching id on the A side and matching type on the B side will return a cable. Can also confirm b termination queries yield similar behavior:
GET /api/dcim/cables/?termination_b_id=4&termination_b_type=dcim.frontport
results in (trimmed):
The text was updated successfully, but these errors were encountered: