Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device Sync issues Netbox 3.7.1 DNA Version 2.3.5.5 #20

Open
amoraras opened this issue Jan 25, 2024 · 3 comments
Open

Device Sync issues Netbox 3.7.1 DNA Version 2.3.5.5 #20

amoraras opened this issue Jan 25, 2024 · 3 comments

Comments

@amoraras
Copy link

amoraras commented Jan 25, 2024

Hello,

After few days trying to have the plugin working, I finally was able to get it almost working. I see the Sites and Devices are discovered, however when i want to sync, the Sites and only 2 devices sync out of 170 and i get this error:

=================================================================
ciscodnacnetbox.ciscodnac.data.full_sync

Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/options.py", line 681, in get_field return self.fields_map[field_name] KeyError: 'device_role' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/ciscodnacnetbox/ciscodnac/netbox.py", line 281, in device Device.objects.filter( File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1188, in update query.add_update_values(kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/subqueries.py", line 88, in add_update_values field = self.get_meta().get_field(name) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/options.py", line 683, in get_field raise FieldDoesNotExist( django.core.exceptions.FieldDoesNotExist: Device has no field named 'device_role' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/options.py", line 681, in get_field return self.fields_map[field_name] KeyError: 'device_role' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/rq/worker.py", line 1428, in perform_job rv = job.perform() File "/opt/netbox/venv/lib/python3.10/site-packages/rq/job.py", line 1278, in perform self._result = self._execute() File "/opt/netbox/venv/lib/python3.10/site-packages/rq/job.py", line 1315, in _execute result = self.func(*self.args, **self.kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/ciscodnacnetbox/ciscodnac/data.py", line 23, in full_sync devices = Data.sync_devices(**kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/ciscodnacnetbox/ciscodnac/data.py", line 335, in sync_devices sync_status = Netbox.Sync.device(tenant=tenant, device=device) File "/opt/netbox/venv/lib/python3.10/site-packages/ciscodnacnetbox/ciscodnac/netbox.py", line 297, in device Device.objects.filter( File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1188, in update query.add_update_values(kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/subqueries.py", line 88, in add_update_values field = self.get_meta().get_field(name) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/options.py", line 683, in get_field raise FieldDoesNotExist( django.core.exceptions.FieldDoesNotExist: Device has no field named 'device_role'

Can't figure out what's the problem with device role, when discover devices, they all have a role, and Netbox creates new according to the ones from DNA based only the two devices netbox was able to add.

Since I had issues making the module working in the beginning, I spun a new VM and installed netbox 3.5.4 and there everything syncs.

the plugin version I believe is the latest:

pip list | grep ciscodnac
ciscodnacnetbox 3.5.0

However in the browser when I get the error, it shows me and older version.

+++++++++++++++++++++++++++++=
<class 'django.core.exceptions.FieldDoesNotExist'>

Device has no field named 'device_role'

Python version: 3.10.12
NetBox version: 3.7.1
Plugins:
ciscodnacnetbox: 3.2.1
netbox_qrcode: 0.0.11
netbox_topology_views: 3.9.0
+++++++++++++++++++++++++++++=

Any help is much appreciated.

@robertcsapo
Copy link
Owner

When you say "2 devices sync out of 170", is all your devices in Catalyst Center (DNAC) tied to a role? Or is there any devices that has "Unknown" or some error state?

@amoraras
Copy link
Author

Hello, all my devices are tied to a role, as you may know DNA will do that by default. Even from Netbox Plugin under the DNA section where shows how many devices/sites are discovered so you can see before sync, when i click on devices, they all have a role.

@mwalton42
Copy link

Hello,

I am having the same issue.
Netbox 3.7.7
ciscodnacnetbox 3.5.0
DNAC 2.3.5.5-70026

cf154d08-7091-4909-8f44-c327b4920d3a | ciscodnacnetbox.ciscodnac.data.full_sync | Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/options.py", line 681, in get_field return self.fields_map[field_name] KeyError: 'device_role' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/ciscodnacnetbox/ciscodnac/netbox.py", line 281, in device Device.objects.filter( File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1188, in update query.add_update_values(kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/subqueries.py", line 88, in add_update_values field = self.get_meta().get_field(name) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/options.py", line 683, in get_field raise FieldDoesNotExist( django.core.exceptions.FieldDoesNotExist: Device has no field named 'device_role' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/options.py", line 681, in get_field return self.fields_map[field_name] KeyError: 'device_role' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/rq/worker.py", line 1430, in perform_job rv = job.perform() File "/opt/netbox/venv/lib/python3.10/site-packages/rq/job.py", line 1280, in perform self._result = self._execute() File "/opt/netbox/venv/lib/python3.10/site-packages/rq/job.py", line 1317, in _execute result = self.func(*self.args, **self.kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/ciscodnacnetbox/ciscodnac/data.py", line 23, in full_sync devices = Data.sync_devices(**kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/ciscodnacnetbox/ciscodnac/data.py", line 335, in sync_devices sync_status = Netbox.Sync.device(tenant=tenant, device=device) File "/opt/netbox/venv/lib/python3.10/site-packages/ciscodnacnetbox/ciscodnac/netbox.py", line 297, in device Device.objects.filter( File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1188, in update query.add_update_values(kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/subqueries.py", line 88, in add_update_values field = self.get_meta().get_field(name) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/options.py", line 683, in get_field raise FieldDoesNotExist( django.core.exceptions.FieldDoesNotExist: Device has no field named 'device_role' -- | -- | --

I get 72 of the 482 devices imported.

Have purged and readded DNA and tried again but still same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants