nautobot
nautobot copied to clipboard
Import/Export * Aren't Inverses
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
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.
.csv header devices
:
- export:
rack_name
- import:
rack
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.
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.
Related: #648
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).
-
Also the
Required
flag does not reflect reality. It shows thatTenant
is not required but when missing, the import crashes with error telling me thatTenant
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.
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"
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.
Initially implemented in #3722 and revised in #4188, #4274, and #4448.