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

DCIM interfaces API endpoint returns VM interfaces #3036

Closed
JuergenKammer opened this issue Apr 3, 2019 · 3 comments
Closed

DCIM interfaces API endpoint returns VM interfaces #3036

JuergenKammer opened this issue Apr 3, 2019 · 3 comments
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@JuergenKammer
Copy link

Environment

  • Python version: 3.6.8
  • NetBox version: 2.5.9

Steps to Reproduce

  1. Create a virtual machine with an interface.
  2. Use the API to list interfaces (you may specifically search by name or whatever, just ensure that you get the interface at the virtual machine returned).

Expected Behavior

The API returns the virtual-machine with the corresponding data, just like it does for a device if a returned interface belongs to a device.

Observed Behavior

There is no reference to a virtual-machine returned. Instead the interface is returned with a "device: null" entry.

Background

I realized this when I gathered up all interfaces via the API, keeping track of the devices: surprisingly I encountered multiple interfaces with the same name on the same "device", then realized they all belonged to the device "null". I realized, ok, no devices, these are virtual machines - but no virtual-machine data is returned.

In fact, this may even be deeper buried: "device" is a required field when doing a POST for an interface (see api_dcim_interfaces_create in api/docs/) . No way to specify a virtual machine instead, which should be there.

@Xelinor
Copy link

Xelinor commented Apr 3, 2019

I believe that is working as intended.

/api/virtualization/interfaces/ is what you are looking for, there is a separate API call for the virtual machine interfaces.

@JuergenKammer
Copy link
Author

Ah, right, I missed that, oups. But...

Should interfaces of virtual machines returned at all when querying for interfaces under /api/dcim/interfaces? To return them under /api/dcim/interfaces (with device = null) when they are under /virtualization/interfaces is not really helping (at least, it fooled me ;-o).

If I query under /api/virtualization/interfaces I only get the interfaces belonging to virtual machines, and not the interfaces under dcim with virtual-machine = null. To have a different behavior in these two trees seems inconsistent.

@jeremystretch
Copy link
Member

Should interfaces of virtual machines returned at all when querying for interfaces under /api/dcim/interfaces?

No. Marking this as a bug.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application labels Apr 4, 2019
@jeremystretch jeremystretch changed the title API /dcim/interfaces does not handle interfaces on virtual machines correctly DCIM interfaces API endpoint returns VM interfaces Apr 4, 2019
@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

No branches or pull requests

3 participants