Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero length cable should be treated as a 0 length cable and not an unknown length cable #13649

Closed
DanSheps opened this issue Aug 31, 2023 · 8 comments · Fixed by #14592
Closed
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation topic: cabling type: bug A confirmed report of unexpected behavior in the application

Comments

@DanSheps
Copy link
Member

NetBox version

v3.6.0

Python version

3.8

Steps to Reproduce

  1. Create all prerequesite objects to have 2 interfaces to connect together (Manufacturer, Type, Role, Device, InterfaceA and InterfaceB)
  2. Connect InterfaceC and InterfaceD together using 0 meters

Expected Behavior

  • The cable detail view should show a distance of 0 meters
  • A cable trace should show a distance of 0 meters

Observed Behavior

  • Detail view shows placeholder data (--)
  • Cable trace considers the distance an unknown distance
@DanSheps DanSheps added the type: bug A confirmed report of unexpected behavior in the application label Aug 31, 2023
@DanSheps
Copy link
Member Author

I came across this while setting up splice boxes using rear ports and front ports. When you set a "0" value for the length, the cable is treated as unknown value and the cable trace shows "approximately".

While there is a nominal (1µm perhaps) of distance added to a splice, it doesn't need to be taken into account, however the distance being accurate is important for reporting purposes (did we miss putting in a length or is it just the "0 length" item).

Underlying this is the API, which reports "None" instead of "0" for the CablePath.get_total_length() method.

@DanSheps DanSheps added status: under review Further discussion is needed to determine this issue's scope and/or implementation topic: cabling severity: low Does not significantly disrupt application functionality, or a workaround is available labels Sep 1, 2023
@DanSheps DanSheps changed the title "Zero" length cable should be treated as a 0 length cable and not an unknown cable Zero length cable should be treated as a 0 length cable and not an unknown length cable Sep 1, 2023
@jeremystretch
Copy link
Member

I think the underlying issue here is that a cable should not be permitted to have a zero length.

@DanSheps
Copy link
Member Author

DanSheps commented Sep 11, 2023

I think there are instances (like I said, when you aren't doing actual cables, but documenting "splices" where a 0-length is going to be desireable. Until we start adding the ability to account for splicing, I think we should allow "0 length" cables and switch to checking for null instead of "not-empty (catches zero as a value)" in 3 places:

dcim/models/cables.py:193
dcim/tables/template_code.py:15
dcim/svg/cables.py:254
templates/dcim/cable.html:53
templates/dcim/trace/cable.html:13

Right now, _abs_length of the cable gets saves as "none" while the actual cable length is 0.0 m

The API is fine as it returns "0.0 m"

A migration would l likely be required to account for those non-zero values in the code and resave _abs_length

@jeremystretch
Copy link
Member

Until we start adding the ability to account for splicing, I think we should allow "0 length" cables

But a splice isn't a cable, and attempting to model it as one violates our tenet of replicating the real world. You're certainly welcome to submit a feature request proposing this ability, but as far as this bug goes IMO the solution is to invalidate zero-length cables.

@jsenecal
Copy link
Contributor

jsenecal commented Sep 12, 2023

I wanted to chime in on this discussion, and I find myself in alignment with @DanSheps regarding the documentation of splice trays and their interconnections. This approach, using "0" and "None," brings clarity to network configurations involving devices with pigtails and splice ports. Let me elaborate further:

Device Configuration:
Devices and modules equipped with pigtails are a common component in fiber optic network setups. Pigtails are essentially short fiber optic cables designed for splicing or connecting other fiber cables. These devices are equipped with front and rear ports of the "splice" type, explicitly meant for splicing optical fibers together.

Splicing in Devices:
When you splice the front and rear ports of these devices together, it effectively results in a "0-length cable." In simpler terms, it means these ports are connected directly, and there is no length of fiber cable between them. This configuration is particularly prevalent in components like splice closures and fiber patch panels with splice trays.

The Significance of "0" and "None":

  • 0: signifies that there is a very short or effectively zero-length cable connecting these ports. It's a practical way to represent the direct splicing of the aforementioned pigtail fibers without any intervening length of fiber cable.
  • None: We could save None, when we're indicating that the length or status of the connection is unknown. This can be useful when we don't have precise information about the connection but want to document its existence.

By adopting this notation, we can maintain consistency in our documentation practices and provide a clear understanding of these specific network configurations. It not only aids in the 80/20 principle of NetBox but also ensures that we accurately represent the physical network infrastructure.

Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions github-actions bot added the pending closure Requires immediate attention to avoid being closed for inactivity label Dec 12, 2023
@wohali
Copy link

wohali commented Dec 12, 2023

Given the closure of #13375 having clarity on this point would be useful.

I also see the value in modeling breakout cables using 0-length splices (vs. None).

If a different approach is preferred could we change this issue into a documentation one?

@jeremystretch
Copy link
Member

We discussed this on the maintainers call today. Let's proceed with respecting zero-length cables, and make the necessary changes to the length calculation logic.

@jeremystretch jeremystretch added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation pending closure Requires immediate attention to avoid being closed for inactivity labels Dec 14, 2023
@jeremystretch jeremystretch self-assigned this Dec 22, 2023
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Dec 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation topic: cabling type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants