netbox: Connecting rear ports through circuit causes error when connecting devices
Environment
- Python version: Python 3.6.8
- NetBox version: 2.6.0
Steps to Reproduce
- Create a circuit
- Create two devices with multiple front ports mapped to a single rear port (mux
- Connect the two rear ports to the circuit
- Connect an interface to a front port of one mux
- Connect an interface to the corresponding front port of the other mux
At this point all is still well: both devices are connected to each other.
- Repeat step 4
This will fail as the first interface connection will have used the circuit termination point id in its _connected_circuittermination_id. The second interface will try to put the same termination point id in its _connected_circuittermination_id, which will fail because that is a OneToOneField.
Expected Behavior
When connecting multiple devices/interfaces through a mux they are expected to share the same circuit. Use cases are CWDM and DWDM. In Django terms: I expected _connected_circuittermination_id to be a ForeignKey, not a OneToOneField.
Observed Behavior
<class 'django.db.utils.IntegrityError'>
duplicate key value violates unique constraint "dcim_interface__connected_circuittermination_id_key"
DETAIL: Key (_connected_circuittermination_id)=(42) already exists.
Notes
This case seems similar to https://github.com/digitalocean/netbox/issues/3193, but is different. That issue applies to cables where the rear port of one mux isn’t directly connected to the rear port of another mux, but is passed through other patch panels (implemented as 1 front port mapped to 1 rear port).
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 17 (14 by maintainers)
I created a demo test case where Site A and Site B are connected using a DWDM circuit with a mux at both ends. Eth1 of router at Site A is connected over
CH35to the router at Site B.I also connected a second mux at Site A to the
Upgport of the first mux. Eth2 of the router at Site A is connected toCH50of the second mux. At site B theUpgport of the mux is conneced to another circuit going to Site C. At that site there is a mux of the same type as the second mux at Site A, and the router at Site C is connected toCH50of that one.Just to create a scenario with nested muxes and multiple circuits 😃
The interfaces of Router A now look like this:
@steffann i see a scenario that would not be covered. when you connect a multiplexer to a extension port of another multiplexer (often 1300nm cwdm or 1550nm dwdm) to extend your network this could break things in documentation…
–> “From Site1 to Site2 via Mux-1 1330nm - Mux-2 1300nm - DarkFiberX - Mux-3 1300nm - Mux-4 1330nm”
That get even more complicated when i add PatchPanel to NetBox…
Thank you very mutch for working on this!
Well, the term “rear-port” is used for the port that aggregates one or more front ports. It doesn’t have to be physically on the rear of the device 😃 And a “front-port” may physically be on the back.