Cable length calculation incorrect when segment lengths are missing #4479

Closed
opened 2025-12-29 18:36:27 +01:00 by adam · 2 comments
Owner

Originally created by @cpmills1975 on GitHub (Jan 20, 2021).

Originally assigned to: @cpmills1975 on GitHub.

Environment

  • Python version: 2.10.3
  • NetBox version: 3.9

Steps to Reproduce

  1. Create two devices
  2. Create two 'patch panel' devices with front and rear ports
  3. Connect the rear ports of the patch panels without specifying the length
  4. Connect the two devices to each of the patch panels and specify the length in one or both
  5. Trace the cable between the devices

Expected Behavior

Ideally, the total length should indicate that it is 'at least' n meters long or in some better way indicate that only some of the lengths were populated and therefore the calculated length is somewhat short of the actual.

Observed Behavior

With only some of the cable lengths specified - perhaps the patch cables between the patch panels and the devices and not the length of the horizontal cable between the patch panels, NetBox outputs a calculated length which is the correct sum of the lengths that it has available in the database. This is obviously incorrect due to missing data, but no indication of this is given to the user who might (not unreasonably) think that the total length as calculated by NetBox is correct.

Originally created by @cpmills1975 on GitHub (Jan 20, 2021). Originally assigned to: @cpmills1975 on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reporting reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, please start a discussion instead: https://github.com/netbox-community/netbox/discussions Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 2.10.3 * NetBox version: 3.9 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. Create two devices 2. Create two 'patch panel' devices with front and rear ports 3. Connect the rear ports of the patch panels without specifying the length 4. Connect the two devices to each of the patch panels and specify the length in one or both 5. Trace the cable between the devices <!-- What did you expect to happen? --> ### Expected Behavior Ideally, the total length should indicate that it is 'at least' n meters long or in some better way indicate that only some of the lengths were populated and therefore the calculated length is somewhat short of the actual. <!-- What happened instead? --> ### Observed Behavior With only some of the cable lengths specified - perhaps the patch cables between the patch panels and the devices and not the length of the horizontal cable between the patch panels, NetBox outputs a calculated length which is the correct sum of the lengths that it has available in the database. This is obviously incorrect due to missing data, but no indication of this is given to the user who might (not unreasonably) think that the total length as calculated by NetBox is correct.
adam added the type: bugstatus: accepted labels 2025-12-29 18:36:27 +01:00
adam closed this issue 2025-12-29 18:36:27 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 21, 2021):

I'm on the fence as to whether this should be considered a bug: NetBox is returning the correct data as far as it knows. I can also imagine a scenario where the user wants to ignore the length of particular cables for some reason.

I'll tag this as "needs owner" for anyone who wants to volunteer.

@jeremystretch commented on GitHub (Jan 21, 2021): I'm on the fence as to whether this should be considered a bug: NetBox is returning the correct data as far as it knows. I can also imagine a scenario where the user wants to ignore the length of particular cables for some reason. I'll tag this as "needs owner" for anyone who wants to volunteer.
Author
Owner

@cpmills1975 commented on GitHub (Jan 22, 2021):

Hi @jeremystretch,

Hope I'm not treading on toes here, but I've raised a PR which I hope addresses this in an appropriate way. If all cables have a length, the display is as current. If not, I prefix the length with a > to indicate that it is 'at least' the length given.

@cpmills1975 commented on GitHub (Jan 22, 2021): Hi @jeremystretch, Hope I'm not treading on toes here, but I've raised a PR which I hope addresses this in an appropriate way. If all cables have a length, the display is as current. If not, I prefix the length with a > to indicate that it is 'at least' the length given.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4479