Skip to content

Incomplete cable termination causes topology to crash #154

@MisterSunbro

Description

@MisterSunbro

Hello there!

It seems to be the problem when trying to display device with existing incomplete cable termination (e.g. when termination A is defined and termination B does not exist)

The complete exception is provided below:

<class 'IndexError'>

list index out of range

Python version: 3.12.3
NetBox version: 4.1.4
Plugins: 
  netbox_reorder_rack: 1.1.3
  nextbox_ui_plugin: 1.0.1

Incomplete cable terminations may arrive when deleting an adjacent interface (or the entire device).

It might be enough to exclude such connections here:

for link in links_from_device:
# Exclude PowerFeed-connected links
if (isinstance(link.a_terminations[0], PowerFeed) or (isinstance(link.b_terminations[0], PowerFeed))):
continue
# Exclude CircuitTermination-connected links
if (isinstance(link.a_terminations[0], CircuitTermination) or (isinstance(link.b_terminations[0], CircuitTermination))):
continue
# Include links to discovered devices only
if link.b_terminations[0].device_id in device_ids:
links.append(link)

But there may be a few more places I haven't noticed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions