exported CSV cannot be reimported again due to wrong side_a_type & side_b_type #4162

Closed
opened 2025-12-29 18:33:33 +01:00 by adam · 7 comments
Owner

Originally created by @4xoc on GitHub (Oct 5, 2020).

Environment

  • Python version: 3.7.9
  • NetBox version: >=2.8

Steps to Reproduce

  1. go to "Devices" > "Cables"
  2. click on export any cable in "CSV (proper formatting for reimport)
  3. download csv
  4. reimport the CSV after deleting the cables

Expected Behavior

The import runs through and creates the cables again.

Observed Behavior

Error message:

Enter the list of column headers followed by one line per record to be imported, using commas to separate values. Multi-line data and values containing commas may be wrapped in double quotes.

    Row 1 side_a_type: Object not found.
    Row 1 side_b_type: Object not found.
    Row 1 __all__: Termination A type has not been specified

The side_a_type & side_b_type are exported as "dcim|interface" however, the import expects just "interface" for both values. Changing this value allows correct reimports/

Might affect more exports/imports

Originally created by @4xoc on GitHub (Oct 5, 2020). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 3.7.9 * NetBox version: >=2.8 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. go to "Devices" > "Cables" 2. click on export any cable in "CSV (proper formatting for reimport) 3. download csv 4. reimport the CSV after deleting the cables <!-- What did you expect to happen? --> ### Expected Behavior The import runs through and creates the cables again. <!-- What happened instead? --> ### Observed Behavior Error message: ``` Enter the list of column headers followed by one line per record to be imported, using commas to separate values. Multi-line data and values containing commas may be wrapped in double quotes. Row 1 side_a_type: Object not found. Row 1 side_b_type: Object not found. Row 1 __all__: Termination A type has not been specified ``` The side_a_type & side_b_type are exported as "dcim|interface" however, the import expects just "interface" for both values. Changing this value allows correct reimports/ Might affect more exports/imports
adam added the status: revisions needed label 2025-12-29 18:33:33 +01:00
adam closed this issue 2025-12-29 18:33:33 +01:00
Author
Owner

@DanSheps commented on GitHub (Oct 5, 2020):

Thank you for opening a bug report. It seems that the described functionality is intended behavior. If you meant to open a feature request instead, please close this issue and open a new one using the feature request template. Otherwise, please revise your post above to elaborate on why you believe the observed behavior is flawed.

@DanSheps commented on GitHub (Oct 5, 2020): Thank you for opening a bug report. It seems that the described functionality is intended behavior. If you meant to open a feature request instead, please close this issue and open a new one using the [feature request template](https://github.com/netbox-community/netbox/issues/new?template=feature_request.md). Otherwise, please revise your post above to elaborate on why you believe the observed behavior is flawed.
Author
Owner

@4xoc commented on GitHub (Oct 6, 2020):

Well, as the export is meant to be "proper format for reimport" and that clearly not being the case I'd consider this an incorrect behavior (even if intended?). Maybe the problem is not with the export itself but the import that rejects the values given from the exported csv and misses support for the "dcim|" prefix?

@4xoc commented on GitHub (Oct 6, 2020): Well, as the export is meant to be "proper format for reimport" and that clearly not being the case I'd consider this an incorrect behavior (even if intended?). Maybe the problem is not with the export itself but the import that rejects the values given from the exported csv and misses support for the "dcim|" prefix?
Author
Owner

@jeremystretch commented on GitHub (Oct 6, 2020):

The side_a_type & side_b_type are exported as "dcim|interface"

This, specifically, is a bug, in that the output format should follow the format <app_label>.<model>; e.g. dcim.interface.

Well, as the export is meant to be "proper format for reimport"

This is an erroneous assumption. Import and export are two entirely separate operations, logically. There are many instances where the two formats differ out of necessity to uniquely identify related objects upon import. Further, #4999 (currently a v2.10 objective) would result in fully dynamic export output depending on how the user has configured the table.

@jeremystretch commented on GitHub (Oct 6, 2020): > The side_a_type & side_b_type are exported as "dcim|interface" This, specifically, is a bug, in that the output format should follow the format `<app_label>.<model>`; e.g. `dcim.interface`. > Well, as the export is meant to be "proper format for reimport" This is an erroneous assumption. Import and export are two entirely separate operations, logically. There are many instances where the two formats differ out of necessity to uniquely identify related objects upon import. Further, #4999 (currently a v2.10 objective) would result in fully dynamic export output depending on how the user has configured the table.
Author
Owner

@DanSheps commented on GitHub (Oct 6, 2020):

This, specifically, is a bug, in that the output format should follow the format <app_label>.<model>; e.g. dcim.interface.

When I tested the export on 2.9.4, I received the proper output:

termination_a_type,termination_a_id,termination_b_type,termination_b_id,type,status,label,color,length,length_unit
dcim.interface,228,dcim.frontport,1,CAT6a,Connected,,,2,m
@DanSheps commented on GitHub (Oct 6, 2020): > This, specifically, is a bug, in that the output format should follow the format `<app_label>.<model>`; e.g. `dcim.interface`. When I tested the export on 2.9.4, I received the proper output: ``` termination_a_type,termination_a_id,termination_b_type,termination_b_id,type,status,label,color,length,length_unit dcim.interface,228,dcim.frontport,1,CAT6a,Connected,,,2,m ```
Author
Owner

@4xoc commented on GitHub (Oct 6, 2020):

May I ask which type you've selected for the export. Because using 'default' also gives me the correct dcim.interface but 'proper format for reimport' does not; also tested on 2.9.4 (ldap docker image).

@4xoc commented on GitHub (Oct 6, 2020): May I ask which type you've selected for the export. Because using 'default' also gives me the correct `dcim.interface` but 'proper format for reimport' does not; also tested on 2.9.4 (ldap docker image).
Author
Owner

@jeremystretch commented on GitHub (Oct 6, 2020):

but 'proper format for reimport' does not

This must be a custom export template created within your installation. It is not part of NetBox. NetBox provides only the default CSV export functionality.

@jeremystretch commented on GitHub (Oct 6, 2020): > but 'proper format for reimport' does not This must be a custom export template created within your installation. It is not part of NetBox. NetBox provides only the default CSV export functionality.
Author
Owner

@4xoc commented on GitHub (Oct 6, 2020):

Oh sorry, I wasn't aware of that being a custom type. Thanks a lot for the help figuring this out.

@4xoc commented on GitHub (Oct 6, 2020): Oh sorry, I wasn't aware of that being a custom type. Thanks a lot for the help figuring this out.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4162