You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: 'django.db.utils.IntegrityError: insert or update on table "dcim_device" violates foreign key constraint' in migrating .json file from Netbox 3.7.8 to Nautobot v2 using netbox impoter
#167
Open
NetOpsChic opened this issue
May 17, 2024
· 1 comment
I am reaching out regarding an issue encountered during the migration process from NetBox to Nautobot as I am pretty new in this domain. Allow me to provide detailed insights into the situation and the steps taken thus far.
Background:
In the migration process, the data from NetBox has been exported into a .dump file. Subsequently, this data was loaded into NetBox, and a JSON file was extracted. The intention is to transfer this data into Nautobot, facilitating a seamless transition between the two platforms.
Current Challenge:
During the migration process into Nautobot, a hurdle has arisen due to the requirement of the "--bypass data validation" flag. While attempting to execute the migration without utilizing this flag, the process encounters constraints, impeding the successful transfer of data.
Netbox v3.7.8
Nautobot v2.X
Issue:
Error sys.exit(main()) File "/opt/nautobot/lib/python3.10/site-packages/nautobot/core/cli/__init__.py", line 293, in main execute_from_command_line([sys.argv[0], *unparsed_args]) File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line utility.execute() File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) File "/opt/nautobot/lib/python3.10/site-packages/nautobot_netbox_importer/management/commands/import_netbox.py", line 89, in handle adapter.import_to_nautobot() File "/opt/nautobot/lib/python3.10/site-packages/nautobot_netbox_importer/diffsync/adapters/netbox.py", line 97, in import_to_nautobot self._atomic_import() File "/usr/lib/python3.10/contextlib.py", line 78, in inner with self._recreate_cm(): File "/opt/nautobot/lib/python3.10/site-packages/django/db/transaction.py", line 246, in __exit__ connection.commit() File "/opt/nautobot/lib/python3.10/site-packages/django/utils/asyncio.py", line 33, in inner return func(*args, **kwargs) File "/opt/nautobot/lib/python3.10/site-packages/django/db/backends/base/base.py", line 266, in commit self._commit() File "/opt/nautobot/lib/python3.10/site-packages/django/db/backends/base/base.py", line 241, in _commit with self.wrap_database_errors: File "/opt/nautobot/lib/python3.10/site-packages/django/db/utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/opt/nautobot/lib/python3.10/site-packages/django/db/backends/base/base.py", line 242, in _commit return self.connection.commit() django.db.utils.IntegrityError: insert or update on table "dcim_device" violates foreign key constraint "dcim_device_primary_ip4_id_2ccd943a_fk_ipam_ipaddress_id" DETAIL: Key (primary_ip4_id)=(some UUID) is not present in table "ipam_ipaddress".
Is there anything I am missing out? Steps that were taken:
Any suggestion is appreciated. Thank you in advance.
The text was updated successfully, but these errors were encountered:
NetOpsChic
changed the title
Issue in migrating .json file from Netbox 3.7.8 to Nautobot v2 using netbox impoter
Issue: 'django.db.utils.IntegrityError: insert or update on table "dcim_device" violates foreign key constraint' in migrating .json file from Netbox 3.7.8 to Nautobot v2 using netbox impoter
Jul 15, 2024
I am reaching out regarding an issue encountered during the migration process from NetBox to Nautobot as I am pretty new in this domain. Allow me to provide detailed insights into the situation and the steps taken thus far.
Background:
In the migration process, the data from NetBox has been exported into a .dump file. Subsequently, this data was loaded into NetBox, and a JSON file was extracted. The intention is to transfer this data into Nautobot, facilitating a seamless transition between the two platforms.
Current Challenge:
During the migration process into Nautobot, a hurdle has arisen due to the requirement of the "--bypass data validation" flag. While attempting to execute the migration without utilizing this flag, the process encounters constraints, impeding the successful transfer of data.
Netbox v3.7.8
Nautobot v2.X
Issue:
Error
sys.exit(main()) File "/opt/nautobot/lib/python3.10/site-packages/nautobot/core/cli/__init__.py", line 293, in main execute_from_command_line([sys.argv[0], *unparsed_args]) File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line utility.execute() File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) File "/opt/nautobot/lib/python3.10/site-packages/nautobot_netbox_importer/management/commands/import_netbox.py", line 89, in handle adapter.import_to_nautobot() File "/opt/nautobot/lib/python3.10/site-packages/nautobot_netbox_importer/diffsync/adapters/netbox.py", line 97, in import_to_nautobot self._atomic_import() File "/usr/lib/python3.10/contextlib.py", line 78, in inner with self._recreate_cm(): File "/opt/nautobot/lib/python3.10/site-packages/django/db/transaction.py", line 246, in __exit__ connection.commit() File "/opt/nautobot/lib/python3.10/site-packages/django/utils/asyncio.py", line 33, in inner return func(*args, **kwargs) File "/opt/nautobot/lib/python3.10/site-packages/django/db/backends/base/base.py", line 266, in commit self._commit() File "/opt/nautobot/lib/python3.10/site-packages/django/db/backends/base/base.py", line 241, in _commit with self.wrap_database_errors: File "/opt/nautobot/lib/python3.10/site-packages/django/db/utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/opt/nautobot/lib/python3.10/site-packages/django/db/backends/base/base.py", line 242, in _commit return self.connection.commit() django.db.utils.IntegrityError: insert or update on table "dcim_device" violates foreign key constraint "dcim_device_primary_ip4_id_2ccd943a_fk_ipam_ipaddress_id" DETAIL: Key (primary_ip4_id)=(some UUID) is not present in table "ipam_ipaddress".
Is there anything I am missing out? Steps that were taken:
On Nautobot instance the JSON file was transffered using scp and data was dumped:
nautobot-server import_netbox --dry-run netbox_data.json
Any suggestion is appreciated. Thank you in advance.
The text was updated successfully, but these errors were encountered: