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

Error when adding new connection to front port. #15016

Open
ivanovuri opened this issue Feb 2, 2024 · 6 comments · May be fixed by #16384
Open

Error when adding new connection to front port. #15016

ivanovuri opened this issue Feb 2, 2024 · 6 comments · May be fixed by #16384
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@ivanovuri
Copy link

ivanovuri commented Feb 2, 2024

Deployment Type

Self-hosted

NetBox Version

v3.7.1

Python Version

3.8

Steps to Reproduce

You can reproduce same behaviour in demo.netbox.dev. All devices was created in NewYork site.

  1. Log-in to public demo site.
  2. Locate NewYork devices: https://demo.netbox.dev/dcim/devices/?site_id=29
  3. Add port connection from NY-Router from port et-0/0/1 to Panel1.1-NY port 1 and port 24.
    image
  4. Press create and get an error))
    image

Crosses connection looks like this:
image

Expected Behavior

I expect a new fancy connection to the patch panel.

Observed Behavior

Server Error
<class 'AssertionError'>

Python version: 3.8.10
NetBox version: 3.7.1
Plugins:
netbox_demo: 0.3.1

@ivanovuri ivanovuri added the type: bug A confirmed report of unexpected behavior in the application label Feb 2, 2024
@ivanovuri ivanovuri changed the title Error when adding new connection to fromt port. Error when adding new connection to front port. Feb 2, 2024
@jeremystretch
Copy link
Member

  1. Log-in to public demo site.

Per the bug report template:

Additionally, do not rely on the demo instance for reproducing suspected bugs, as its data is prone to modification or deletion at any time.

Please revise your report above to include complete instructions that someone else can follow to reproduce the reported behavior. Otherwise, it will be closed as invalid.

@jeremystretch jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Feb 2, 2024
@ivanovuri
Copy link
Author

ivanovuri commented Feb 3, 2024

Ok, It's a pity but the same bahaviour on all version and you even not need to do anything.

To reproduce you should do:

  1. Create Panel1.1 Generic device
  2. Add a new rear port splice named "Rare port splice to Panel1.2" with 12 positions
  3. Add a new 12 front ports from 1 - 12 and attach it to newly created rare splice.
  4. Add a new rear port splice "Rare port splice to Panel1.3" with 12 positions
  5. Add a new 12 front ports from 24-35 and attach it to newly created rare splice.
  6. Create rear port splice name "Rare port splice" Panel1.3 Generic device
  7. Add a new rear port splice named "Rare port splice" with 12 positions
  8. Add a new 12 front ports from 1 - 12 and attach it to newly created rare splice.
  9. Create Panel1.3 Generic device
  10. Add a new rear port splice named "Rare port splice" with 12 positions
  11. Add a new 12 front ports from 1-12 and attach it to newly created rare splice.
  12. Connect rear splice named "Rare port splice to Panel1.2" rear port splice name "Rare port splice" Panel1.2
  13. Connect rear splice named "Rare port splice to Panel1.3" rear port splice name "Rare port splice" Panel1.3
  14. Connect router port as was shown in image in first message (add port connection from NY-Router from port et-0/0/1 to Panel1.1-NY port 1 and port 24).

@jeremystretch jeremystretch removed the status: revisions needed This issue requires additional information to be actionable label Feb 5, 2024
@jeremystretch jeremystretch added the status: needs triage This issue is awaiting triage by a maintainer label Mar 26, 2024
@jeffgdotorg jeffgdotorg self-assigned this Apr 1, 2024
@jeffgdotorg
Copy link
Contributor

Thank you for making the requested updates to your report. I was able to reproduce the behavior on a v3.7.4 system using the new steps provided.

I also obtained the following traceback from v3.7.4, which may be helpful to the next person to work this issue:

Internal Server Error: /dcim/cables/add/
Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/dcim/views.py", line 3194, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 175, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/netbox/views/generic/base.py", line 26, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/utilities/views.py", line 106, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 269, in post
    obj = form.save()
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/forms/models.py", line 542, in save
    self.instance.save()
  File "/opt/netbox/netbox/dcim/models/cables.py", line 240, in save
    trace_paths.send(Cable, instance=self, created=_created)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 176, in send
    return [
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 177, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "/opt/netbox/netbox/dcim/signals.py", line 98, in update_connected_endpoints
    create_cablepath(nodes)
  File "/opt/netbox/netbox/dcim/utils.py", line 43, in create_cablepath
    cp = CablePath.from_origin(terminations)
  File "/opt/netbox/netbox/dcim/models/cables.py", line 547, in from_origin
    assert all(t.parent_object == terminations[0].parent_object for t in terminations[1:])
AssertionError

@jeffgdotorg jeffgdotorg added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Apr 1, 2024
@jeffgdotorg jeffgdotorg removed their assignment Apr 1, 2024
@jeffgdotorg
Copy link
Contributor

@ivanovuri have you had a chance to re-test this workflow in NetBox 4.0.x? We think there's a chance it got fixed as a side effect of other work, so before I mount a new effort to reproduce it, I thought I'd check with you.

@maugli13
Copy link

This issue is reproducible in both 3.7.8 and 4.0.2 (used demo netbox)

The following scenario was tested:

  1. Created PatchPanel1.1 with two sets of Front ports, six ports in each related to 1 rear port with six positions. (Got PatchPanel with 12 front ports and two rear ports, six positions in each)
  2. Created PP2 with six front ports related to the rear port with six positions
  3. Created PP3 with six front ports related to the rear port with six positions
  4. Connected first rear port of PatchPanel1.1 to the rear port in PP2
  5. Connected second rear port of PatchPanel1.1 to the rear port in PP3

Intermediate result:

Screenshot 2024-05-21 at 15 06 24
  1. Created a switch and tried to connect the first port of the switch to multiple front ports on PatchPanel1.1 (see the screenshot below)
Screenshot 2024-05-21 at 15 08 04
  1. Clicked create and got the following error
Screenshot 2024-05-21 at 15 08 47

@DanSheps DanSheps 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 May 29, 2024
@DanSheps DanSheps self-assigned this May 29, 2024
@DanSheps DanSheps added status: under review Further discussion is needed to determine this issue's scope and/or implementation and removed status: accepted This issue has been accepted for implementation labels May 29, 2024
@DanSheps
Copy link
Member

Double checking the code on this, the problem is here:

# All mid-span terminations must all be attached to the same device

I don't thinkk this is really a bug (it is currently not supported to have different devices "mid-span" of a cable trace), but we should catch this assertion and report a proper error.

@DanSheps DanSheps added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
5 participants