Skip to content

Create a new cable on an already used interface (API) #10929

@Etibru

Description

@Etibru

NetBox version

v3.3.7

Python version

3.9

Steps to Reproduce

  1. Create a cable between 2 blank interfaces
    Using api to create a cable (/api/dcim/cables/)
data_cable = {
        "a_terminations": [
            {
                "object_type": "dcim.interface",
                "object_id": 31,
            },
        ],
        "b_terminations": [
            {
                "object_type": "dcim.interface",
                "object_id": 59,
            },
        ],
        "status": "connected",
    }

OK
2. Repeat with the same interface for B and another one for A

data_cable = {
        "a_terminations": [
            {
                "object_type": "dcim.interface",
                "object_id": 32,
            },
        ],
        "b_terminations": [
            {
                "object_type": "dcim.interface",
                "object_id": 59,
            },
        ],
        "status": "connected",
    }
  1. Error 500

Expected Behavior

Note the fact that the interface is already in use

Observed Behavior

django.db.utils.IntegrityError: duplicate key value violates unique constraint "dcim_cable_termination_unique_termination" DETAIL: Key (termination_type_id, termination_id)=(32, 59) already exists.

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