Skip to content

Error when assigning a VM interface to a parent interface #6710

@jeremystretch

Description

@jeremystretch

NetBox version

v2.11.8

Python version

3.7

Steps to Reproduce

  1. Create a new VM and note its ID (ex: 123)
  2. Create interface eth0 on the VM and note its ID (ex: 456)
  3. Make a REST API call to create a second interface on the VM, assigning the first interface as its parent:
curl -X POST \
-H "Authorization: Token $TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
http://netbox/api/virtualization/interfaces/ \
--data '{"virtual_machine": 123, "name": "new", "parent": 456}'

This was originally reported under #6709.

Expected Behavior

The second interface should be created successfully, with the first interface assigned as its parent.

Observed Behavior

One of two things might happen, depending on how many device interfaces have been created:

  1. A ValueError exception is raised.
  2. The following error is returned:
{
    "parent": [
        "Related object not found using the provided numeric ID: 456"
    ]
}

This is due a bug in the definition of NestedVirtualMachineSerializer, which incorrectly references the dcim.Interface model.

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions