Skip to content

Unexpected results from query GET /api/dcim/cables/ with termination_a_id and termination_a_type query parameters #14274

@thomas-esposito

Description

@thomas-esposito

NetBox version

v3.6.5

Python version

3.10

Steps to Reproduce

  1. create 2 devices with front ports and a device with interfaces
  2. find ids that overlap (ex: front port id = 2 and interface id = 2)
  3. create a cable from the interface to a front port on the 2nd device (ex: interface 2 to front port 20)
  4. query GET /api/dcim/cables/?termination_a_id=2&termination_a_type=dcim.frontport
  5. review results

Expected Behavior

No cable - in this scenario, front port 2 belonging to device 1 has no cable. Front port 20 belonging to device 2 has a cable to interface 2.

Observed Behavior

The query asks for termination_a_id=2 and termination_a_type=dcim.frontport but returns a cable where termination_a_id=2 and termination_b_type=dcim.frontport

Have also tested this with rear cables. A matching id on the A side and matching type on the B side will return a cable. Can also confirm b termination queries yield similar behavior:

GET /api/dcim/cables/?termination_b_id=4&termination_b_type=dcim.frontport
results in (trimmed):

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "a_terminations": [
                {
                    "object_type": "dcim.frontport",
                    "object_id": 12
                }
            ],
            "b_terminations": [
                {
                    "object_type": "dcim.interface",
                    "object_id": 4
                }
            ],
            "status": {
                "value": "connected",
                "label": "Connected"
            }
        }
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    severity: mediumResults in substantial degraded or broken functionality for specfic workflowstype: 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