Skip to content
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

/api/dcim/interfaces?form_factor=0 (Virtual Interface) returns 0 results #2606

Closed
DanSheps opened this issue Nov 22, 2018 · 2 comments · Fixed by #2610
Closed

/api/dcim/interfaces?form_factor=0 (Virtual Interface) returns 0 results #2606

DanSheps opened this issue Nov 22, 2018 · 2 comments · Fixed by #2610
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@DanSheps
Copy link
Member

Environment

  • Python version: Python 3.4
  • NetBox version: 2.4.8

Steps to Reproduce

  • Create a virtual interface (form_factor=0)
  • Create a LAG interface
  • Create a Physical 10GBE Interface (form_factor=1000)
  • Run an API query against /api/dcim/interfaces?form_factor=0
    Result will be a count: 0
  • Run an API query against /api/dcim/interfaces?form_factor=200
    Result will be a count of at least 1 (depends on environment)

Expected Behavior

  • API will return virtual interfaces for form_factor=0
  • API will return LAG interfaces for form_factor=200
  • API will return 1000GBE interfaces for form_factor=1000

Observed Behavior

  • API does not return interfaces for form_factor=0
  • API returns interfaces for form_factor=200
  • API returns interfaces for form_factor=1000
@DanSheps
Copy link
Member Author

I believe this is strictly related to form_factor=0 only, however I don't have time to investigate further today. I did test this on a clean netbox 2.4.8 as well.

@DanSheps
Copy link
Member Author

Appears to be related to the fact that 0 is treated as a null value.

To fix:

form_factor = django_filters.MultipleChoiceFilter( choices=IFACE_FF_CHOICES, null_value=None )

DanSheps added a commit to DanSheps/netbox that referenced this issue Nov 23, 2018
@jeremystretch jeremystretch added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation beta and removed beta labels Nov 26, 2018
jeremystretch pushed a commit that referenced this issue Nov 26, 2018
* Fixes #2606 - Added MultipleChoiceFilter for form_factor

* Fixes #2606 - Add MultipleChoiceField for form_factor
Fixes error with too many lines.
jeremystretch added a commit that referenced this issue Nov 26, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants