nautobot icon indicating copy to clipboard operation
nautobot copied to clipboard

Import/Export * Aren't Inverses

Open dgjustice opened this issue 3 years ago • 7 comments

Environment

  • Python version:
  • Nautobot version:

Steps to Reproduce

Expected Behavior

Export devices, then copy/paste this into import successfully. I haven't tested other models.

Observed Behavior

import<>export aren't inverses. Export spits out extra fields that import won't eat. Import status uses slug, but export sends the Name.

TODO

  • [ ] #648
  • [x] #2276
  • [ ] #851
  • [x] #1407
  • [ ] #1797
  • [ ] Make Device Import/Export Inverses
  • [ ] #2569

Related (New Feature Request)

  • [ ] #1543

dgjustice avatar Apr 06 '21 21:04 dgjustice

Thanks for the report!

FWIW, the NetBox maintainers have previously asserted that this is "by design" - see https://github.com/netbox-community/netbox/issues/4429, https://github.com/netbox-community/netbox/issues/4656, https://github.com/netbox-community/netbox/issues/4677, https://github.com/netbox-community/netbox/issues/5270, etc.

That said, we may well want to revisit this design in Nautobot.

glennmatthews avatar Apr 07 '21 12:04 glennmatthews

.csv header devices:

  • export: rack_name
  • import: rack

jifox avatar Apr 29 '21 11:04 jifox

We won't be able to get to this immediately, but it's worth noting that a similar change was made in NetBox 2.11. We would happily welcome contributions from anyone willing to port the change over, with proper credit of course.

jathanism avatar May 28 '21 19:05 jathanism

I am of the mind that we fix this in finality in v2.x using django-import-export and put this issue to rest without having to maintain the problem ourselves.

jathanism avatar Dec 21 '21 20:12 jathanism

Related: #648

bryanculver avatar Jan 18 '22 20:01 bryanculver

Hi, not sure if you're aware of this but I also noticed that the import requires different data value (slug vs name) for different columns - at least when talking about Device import.

  • See the image, which probably will be more descriptive (this is also very confusing and should be unified). image

  • Also the Required flag does not reflect reality. It shows that Tenant is not required but when missing, the import crashes with error telling me that Tenant actually is mandatory.

This maybe is not strictly following the import/export inverse topic but on the other hand is quite a nasty inconsistency when dealing with imports.

david-kn avatar Apr 01 '22 14:04 david-kn

Adding some export/import inconsistencies which are not specifically mentioned here but are problem for us. field "rack_number" in export has to be "rack" in import field "rack_face" in export has to be "face" in import field "rack_face" has value "Front" in export but in import it has to be "front"

martin-networker avatar Jul 13 '22 07:07 martin-networker

We have issues open related to improving import/export with respect to M2Ms and usage of composite keys and natural keys but all tasks above are done and import and exports are sufficiently inverse.

bryanculver avatar Aug 10 '23 17:08 bryanculver

Initially implemented in #3722 and revised in #4188, #4274, and #4448.

glennmatthews avatar Sep 21 '23 18:09 glennmatthews