Disallow creation of cables between sites #2380

Closed
opened 2025-12-29 17:25:32 +01:00 by adam · 6 comments
Owner

Originally created by @candlerb on GitHub (Feb 14, 2019).

Environment

  • Python version: 3.5.2
  • NetBox version: 2.5.6

Steps to Reproduce

  1. Create device A in site 1
  2. Create device B in site 2
  3. Create a cable between device A and device B

Expected Behavior

This should be forbidden - "circuits" exist for site-to-site links.

As far as I can see, it used to be forbidden way back (#49).

Observed Behavior

Inter-site cable can be created.

This is a Bad Thing™. Suppose you have 100 similar POPs, and you want to record a cable between pop1-rtr1 and pop1-sw2. Netbox lets you accidentally add a cable between pop1-rtr1 and pop2-sw2.

Originally created by @candlerb on GitHub (Feb 14, 2019). ### Environment * Python version: 3.5.2 * NetBox version: 2.5.6 ### Steps to Reproduce 1. Create device A in site 1 2. Create device B in site 2 3. Create a cable between device A and device B ### Expected Behavior This should be forbidden - "circuits" exist for site-to-site links. As far as I can see, it used to be forbidden way back (#49). ### Observed Behavior Inter-site cable can be created. This is a Bad Thing™. Suppose you have 100 similar POPs, and you want to record a cable between pop1-rtr1 and pop1-sw2. Netbox lets you accidentally add a cable between pop1-rtr1 and pop2-sw2.
adam closed this issue 2025-12-29 17:25:32 +01:00
Author
Owner

@tb-killa commented on GitHub (Feb 14, 2019):

I think this depends on usage of netbox :

How you choose to use sites will depend on the nature of your organization, but typically a site will equate to a building or campus.

I think it should be allowed to build this type of connections.

@tb-killa commented on GitHub (Feb 14, 2019): I think this depends on usage of netbox : How you choose to use sites will depend on the nature of your organization, but typically a site will equate to a building or campus. I think it should be allowed to build this type of connections.
Author
Owner

@candlerb commented on GitHub (Feb 14, 2019):

Fair enough. I don't mind a global switch, similar to ENFORCE_GLOBAL_UNIQUE for IP addresses.

Less good would be a dialog box ("You are about to create a cable between two different sites, are you sure?"). But with that I'd have to run a periodic report to check for violations.

Rackgroups could be another way to represent buildings on a campus - but I can see you might be using it for some other purpose (like rooms within a building)

@candlerb commented on GitHub (Feb 14, 2019): Fair enough. I don't mind a global switch, similar to `ENFORCE_GLOBAL_UNIQUE` for IP addresses. Less good would be a dialog box ("You are about to create a cable between two different sites, are you sure?"). But with that I'd have to run a periodic report to check for violations. Rackgroups could be another way to represent buildings on a campus - but I can see you might be using it for some other purpose (like rooms within a building)
Author
Owner

@candlerb commented on GitHub (Feb 14, 2019):

Aha, I found the commit at which adding connections between sites was allowed: 900ba146

So this needs to change from "bug report" to "feature request".

@candlerb commented on GitHub (Feb 14, 2019): Aha, I found the commit at which adding connections between sites was allowed: 900ba146 So this needs to change from "bug report" to "feature request".
Author
Owner

@candlerb commented on GitHub (Feb 14, 2019):

Environment

  • Python version: 3.5.2
  • NetBox version: 2.5.6

Proposed Functionality

Simplest: Add a global switch to prevent creation of cables between devices in different sites.

More complex variants are possible (e.g. having a flag at Region level which allows cables to be created between sites in that Region).

Use Case

Reducing the possible cable endpoints reduces data errors.

Suppose you have 100 similar POPs, and you want to record a cable between pop1-rtr1 and pop1-sw2. At the moment, Netbox lets you accidentally add a cable between pop1-rtr1 and pop2-sw2.

This is a subtle error and may not go noticed for some time (although it could be identified by suitable application of the Reports feature)

Database Changes

None

External Dependencies

None

@candlerb commented on GitHub (Feb 14, 2019): ### Environment * Python version: 3.5.2 * NetBox version: 2.5.6 ### Proposed Functionality Simplest: Add a global switch to prevent creation of cables between devices in different sites. More complex variants are possible (e.g. having a flag at Region level which allows cables to be created between sites in that Region). ### Use Case Reducing the possible cable endpoints reduces data errors. Suppose you have 100 similar POPs, and you want to record a cable between pop1-rtr1 and pop1-sw2. At the moment, Netbox lets you accidentally add a cable between pop1-rtr1 and pop2-sw2. This is a subtle error and may not go noticed for some time (although it could be identified by suitable application of the Reports feature) ### Database Changes None ### External Dependencies None
Author
Owner

@jeremystretch commented on GitHub (Feb 15, 2019):

As others have pointed out, this depends entirely on how you choose to use sites. NetBox doesn't make any assumptions in that regard.

I also don't see any need for a switch for this. You're filtering by site or device name when you create a cable anyway. It would be yet another layer of arbitrary validation we would need to hotwire in various places.

@jeremystretch commented on GitHub (Feb 15, 2019): As others have pointed out, this depends entirely on how you choose to use sites. NetBox doesn't make any assumptions in that regard. I also don't see any need for a switch for this. You're filtering by site or device name when you create a cable anyway. It would be yet another layer of arbitrary validation we would need to hotwire in various places.
Author
Owner

@candlerb commented on GitHub (Feb 15, 2019):

You're filtering by site or device name when you create a cable anyway.

Not by default. When I click on the "Connect" button next to an interface, this is what I get:

image

That is, I can enter any part of a device's name. (Aside: requires unique device names, ref #2669)

However, if I click the "Select" tab, then it prompts for the site (and rack).

image

When using this tab, it's not as easy to make a mistake. However if the "Site" and "Rack" from the A side were already selected as defaults, this would be even better. (Most of the time you're connecting within the rack, and even when not, you still have to select the rack and/or site)

@candlerb commented on GitHub (Feb 15, 2019): > You're filtering by site or device name when you create a cable anyway. Not by default. When I click on the "Connect" button next to an interface, this is what I get: ![image](https://user-images.githubusercontent.com/44789/52870296-6f35ac80-313f-11e9-9b80-43cf8ac969a9.png) That is, I can enter any part of a device's name. (Aside: requires unique device names, ref #2669) However, if I click the "Select" tab, *then* it prompts for the site (and rack). ![image](https://user-images.githubusercontent.com/44789/52870431-bd4ab000-313f-11e9-9337-ad4c9f391d4f.png) When using this tab, it's not as easy to make a mistake. However if the "Site" and "Rack" from the A side were already selected as defaults, this would be even better. (Most of the time you're connecting within the rack, and even when not, you still have to select the rack and/or site)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2380