robertcsapo / ciscodnacnetbox

Cisco DNA Center Integration with NetBox
Other
35 stars 16 forks source link

Install fails on v3.5.6 #19

Closed fue36 closed 5 months ago

fue36 commented 11 months ago

Version ciscodnacnetbox 3.5.0 on netbox 3.5.6 using python 3.9.18. Initial installation succeeds, database is registered. The Cisco DNA Center Settings can be set, however when clicking on /sync button it generates the following error:

ciscodnacnetbox.ciscodnac.data.full_sync Traceback (most recent call last): File "/opt/netbox/venv/lib64/python3.9/site-packages/rq/worker.py", line 1428, in perform_job rv = job.perform() File "/opt/netbox/venv/lib64/python3.9/site-packages/rq/job.py", line 1278, in perform self._result = self._execute() File "/opt/netbox/venv/lib64/python3.9/site-packages/rq/job.py", line 1315, in _execute result = self.func(*self.args, **self.kwargs) File "/opt/netbox/venv/lib64/python3.9/site-packages/ciscodnacnetbox/ciscodnac/data.py", line 22, in full_sync sites = Data.sync_sites(**kwargs) File "/opt/netbox/venv/lib64/python3.9/site-packages/ciscodnacnetbox/ciscodnac/data.py", line 201, in sync_sites for site in tenants.sites(tenant=dnac): File "/opt/netbox/venv/lib64/python3.9/site-packages/ciscodnacnetbox/ciscodnac/__init__.py", line 75, in sites return tenant.sites.get_site().response AttributeError: 'NoneType' object has no attribute 'sites'

robertcsapo commented 11 months ago

I've used NetBox e8af1e94ebdd (v3.5.6) and DNAC Version 2.3.3.6-70045 With the latest ciscodnacnetbo 3.5.0.

The job completed.

netbox-docker-netbox-worker-1        | 17:41:04 default: ciscodnacnetbox.ciscodnac.data.full_sync() (6df86328-4bd3-4c82-8a85-0d90a2705014)
netbox-docker-netbox-1               | 172.19.0.1 - - [07/Jan/2024:17:41:04 +0000] "GET /plugins/ciscodnacnetbox/sync/full/ HTTP/1.1" 200 83855 "http://localhost:8000/plugins/ciscodnacnetbox/status/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
netbox-docker-netbox-1               | 172.19.0.1 - - [07/Jan/2024:17:41:05 +0000] "GET /plugins/ciscodnacnetbox/job/6df86328-4bd3-4c82-8a85-0d90a2705014/ HTTP/1.1" 200 158 "http://localhost:8000/plugins/ciscodnacnetbox/sync/full/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
netbox-docker-netbox-1               | 127.0.0.1 - - [07/Jan/2024:17:41:07 +0000] "GET /api/ HTTP/1.1" 200 510 "-" "curl/7.81.0"
netbox-docker-netbox-worker-1        | 17:41:07 default: Job OK (6df86328-4bd3-4c82-8a85-0d90a2705014)
netbox-docker-netbox-worker-1        | 17:41:07 Result is kept for 500 seconds
netbox-docker-netbox-1               | 172.19.0.1 - - [07/Jan/2024:17:41:09 +0000] "GET /plugins/ciscodnacnetbox/job/6df86328-4bd3-4c82-8a85-0d90a2705014/ HTTP/1.1" 200 208 "http://localhost:8000/plugins/ciscodnacnetbox/sync/full/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"

It looks like the DNAC SDK returns None. Do you have sites in your DNAC?

fue36 commented 7 months ago

Sorry for the late reply, yes we have sites. https://dnac.localhost/dna/intent/api/v1/site returns about back a prettied JSON response with 4025 lines.

fue36 commented 7 months ago

So now we are using DNAC 2.3.5.5-70026 with Netbox v3.5.6. I managed to get to work. I can't say for sure what caused "_File "/opt/netbox/venv/lib64/python3.9/site-packages/ciscodnacnetbox/ciscodnac/init.py", line 75, in sites return tenant.sites.getsite().response AttributeError: 'NoneType' object has no attribute 'sites' ". I can say that I can recreate the issue by typing in incorrect credentials, invalid IP, etc. So it may be a lack of error checking (try) in another part of the code.

fue36 commented 5 months ago

I'm closing this issue since I got to work on my earlier comment on May 2nd.