netbox icon indicating copy to clipboard operation
netbox copied to clipboard

Negation filter not working for cables - termination type

Open amk1969 opened this issue 1 year ago • 2 comments

NetBox version

v3.6.6

Python version

3.8

Steps to Reproduce

Connect cables between different endpoint types. List cables of one type connected to a device List cables of the other types connected to a device

Expected Behavior

Filter expression termination_a_type__n should return cables with termination type other than queried.

Observed Behavior

Filter expression termination_a_type__n returns the same result as termination_a_type

amk1969 avatar Nov 30 '23 22:11 amk1969

Encountered a problem to determine type of a cable endpoint. Is there a property that would return termination_type of a particular cable object? With pynetbox I am getting the interface/console object itself, is there a way to get the value of 'object_type' used to create the cable?

Trying to workaround the above problem, I try to enumerate cables of various types. Here I found the problem when trying to confirm there is no cable connected to other endpoint than interface or console. Issue is reproducible also with current demo version, queries like https://demo.netbox.dev/dcim/cables/?device=mysampledevice1&termination_a_type=dcim.consoleport and https://demo.netbox.dev/dcim/cables/?device=mysampledevice1&termination_a_type__n=dcim.consoleport return the same results.

Could this be related to https://github.com/netbox-community/netbox/issues/11819 ?

Attached script reproduces the issue in the demo instance. cables-by-type.txt

amk1969 avatar Nov 30 '23 22:11 amk1969

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

github-actions[bot] avatar Mar 05 '24 04:03 github-actions[bot]

Beginning with NetBox v3.7.0, the object type-specific cable termination filters introduced in #14434 should be used, as the generic filters (termination_a_type & termination_b_type) are inherently very limited in their functionality.

jeremystretch avatar Mar 27 '24 16:03 jeremystretch