Cable import dependence by "site #8496

Closed
opened 2025-12-29 20:37:26 +01:00 by adam · 8 comments
Owner

Originally created by @Bottman99 on GitHub (Aug 23, 2023).

NetBox version

v3.5.8

Feature type

Change to existing functionality

Proposed functionality

Add a mandatory field "site" for the cable import.

Use case

The cable import does not check for the site and is unfortunately not possible in a multisite environment if the names of the end devices are identical in the sites.

Database changes

A "site" query must be made before the a_ & b_ terminations are queried at the a_&b_ devices.

External dependencies

No response

Originally created by @Bottman99 on GitHub (Aug 23, 2023). ### NetBox version v3.5.8 ### Feature type Change to existing functionality ### Proposed functionality Add a mandatory field "site" for the cable import. ### Use case The cable import does not check for the site and is unfortunately not possible in a multisite environment if the names of the end devices are identical in the sites. ### Database changes A "site" query must be made before the a_ & b_ terminations are queried at the a_&b_ devices. ### External dependencies _No response_
adam added the type: featurepending closurestatus: revisions needed labels 2025-12-29 20:37:26 +01:00
adam closed this issue 2025-12-29 20:37:26 +01:00
Author
Owner

@abhi1693 commented on GitHub (Aug 23, 2023):

You can use https://docs.netbox.dev/en/stable/customization/custom-validation/ for applying your own validations

@abhi1693 commented on GitHub (Aug 23, 2023): You can use https://docs.netbox.dev/en/stable/customization/custom-validation/ for applying your own validations
Author
Owner

@Bottman99 commented on GitHub (Aug 23, 2023):

I do not have such a selection option under "customisation".
Only:
Customization
Custom Fields
Custom Links
Export Templates
Saved Filters
Tags
Image Attachments
Reports
Scripts

Where is the the [CUSTOM_VALIDATORS] configuration parameter?

I don't know if that really helps either.

The CSV netbox importer does not ask for the "site". But we have to export and import cables via csv in one site as well as in the other.
The first is not a problem, I can export with site information, but when importing it seems to be irrelevant and it complains that it doesn't know which devices it should connect because they are named the same in the sites.

@Bottman99 commented on GitHub (Aug 23, 2023): I do not have such a selection option under "customisation". Only: Customization Custom Fields Custom Links Export Templates Saved Filters Tags Image Attachments Reports Scripts Where is the the [CUSTOM_VALIDATORS] configuration parameter? I don't know if that really helps either. The CSV netbox importer does not ask for the "site". But we have to export and import cables via csv in one site as well as in the other. The first is not a problem, I can export with site information, but when importing it seems to be irrelevant and it complains that it doesn't know which devices it should connect because they are named the same in the sites.
Author
Owner

@kkthxbye-code commented on GitHub (Aug 23, 2023):

@abhi1693 - I think you are misunderstanding, he's saying that importing cables where the device of one of the sides (or both for that matter) is a device without a unique name, the import will fail with an error like this:

image

@Bottman99 - Please make proper replication steps to trigger the issue that you are trying to solve.

@kkthxbye-code commented on GitHub (Aug 23, 2023): @abhi1693 - I think you are misunderstanding, he's saying that importing cables where the device of one of the sides (or both for that matter) is a device without a unique name, the import will fail with an error like this: ![image](https://github.com/netbox-community/netbox/assets/400797/d48f6aaf-bca0-40c6-b082-8ebd8bcc2433) @Bottman99 - Please make proper replication steps to trigger the issue that you are trying to solve.
Author
Owner

@Bottman99 commented on GitHub (Aug 23, 2023):

@kkthxbye-code
To be honest, I don't know what else to add.
The excerpt of the error message from you is correct.
Did you see my post before?

Workaround at the moment is to rename all end devices in a "site" and after the cable export do the same again in reverse. This is a very impractical thing to do.

@Bottman99 commented on GitHub (Aug 23, 2023): @kkthxbye-code To be honest, I don't know what else to add. The excerpt of the error message from you is correct. Did you see my post before? Workaround at the moment is to rename all end devices in a "site" and after the cable export do the same again in reverse. This is a very impractical thing to do.
Author
Owner

@jeremystretch commented on GitHub (Aug 23, 2023):

@Bottman99 please put some more effort into your proposal above. What specifically are you suggesting be added? A single site column wouldn't make sense: What if either end of the cable is in a different site? Presumably you mean to add a site column for each end?

But even that wouldn't be sufficient. What about tenant assignment? NetBox permits duplicate device names per site if each device is assigned to a different tenant. Should the proposal include two columns for tenant assignment as well?

Add a mandatory field "site" for the cable import.

That would be awfully burdensome for the vast majority of cases where duplicate device names are not a concern. At most, these would be optional fields.

FWIW, you can work around this limitation by specifying the numeric ID for each device instead of its name, by altering the device column name from e.g. side_a_device to side_a_device.id. This ensures that each device is always uniquely identified.

@jeremystretch commented on GitHub (Aug 23, 2023): @Bottman99 please put some more effort into your proposal above. What _specifically_ are you suggesting be added? A single `site` column wouldn't make sense: What if either end of the cable is in a different site? Presumably you mean to add a site column for each end? But even that wouldn't be sufficient. What about tenant assignment? NetBox permits duplicate device names per site if each device is assigned to a different tenant. Should the proposal include two columns for tenant assignment as well? > Add a mandatory field "site" for the cable import. That would be awfully burdensome for the vast majority of cases where duplicate device names are not a concern. At most, these would be optional fields. FWIW, you can work around this limitation by specifying the numeric ID for each device instead of its name, by altering the device column name from e.g. `side_a_device` to `side_a_device.id`. This ensures that each device is always uniquely identified.
Author
Owner

@Bottman99 commented on GitHub (Aug 30, 2023):

@jeremystretch
we have a stand alone system mapped into Netbox, which also has no connection to the outside world, neither to other sites.
An approximate/simplified copy of this system (therefore the same names, as the project is the same) in the same Netbox represents the reference system in another site.
The sites are assigned to a different tenant. But the device and rack names etc. are the same.
If you now want to import cable lists for one of the two sites, an error message is presented, as there is no query as to "which site_a or site_b or which tenant the devices belong to".

We will never connect the two sites to each other.
Unfortunately, the devices must/should have the same name in both sites for allocation reasons in SAP.

The idea was to add a relevant field to the import cables which pre-filters by tenant if necessary. If other Netbox users want to connect the site with Tenent_a to another site, this should of course still work. We would then pass 2x the same tenant, others would then specify two different ones for each device in which site_tenant is also assigned.

@Bottman99 commented on GitHub (Aug 30, 2023): @jeremystretch we have a stand alone system mapped into Netbox, which also has no connection to the outside world, neither to other sites. An approximate/simplified copy of this system (therefore the same names, as the project is the same) in the same Netbox represents the reference system in another site. The sites are assigned to a different tenant. But the device and rack names etc. are the same. If you now want to import cable lists for one of the two sites, an error message is presented, as there is no query as to "which site_a or site_b or which tenant the devices belong to". We will never connect the two sites to each other. Unfortunately, the devices must/should have the same name in both sites for allocation reasons in SAP. The idea was to add a relevant field to the import cables which pre-filters by tenant if necessary. If other Netbox users want to connect the site with Tenent_a to another site, this should of course still work. We would then pass 2x the same tenant, others would then specify two different ones for each device in which site_tenant is also assigned.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 29, 2023):

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[bot] commented on GitHub (Nov 29, 2023): 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](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Dec 29, 2023):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Dec 29, 2023): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8496