scaleway / netbox-netprod-importer

Poll data from network devices in production and import it into netbox
GNU General Public License v3.0
100 stars 31 forks source link

API 404 Error #58

Open haukened opened 2 years ago

haukened commented 2 years ago

Hello, while trying to import my Nexus device, i get the following error when the importer hits the netbox API: 404 Client Error: Not Found for url: https://ipam.xxxx.com/api/dcim/_choices/?limit=50 --

it doesn't appear that the /api/dcim/ endpoint has a _choices option anymore:

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "cables": "https://ipam.xxxx.com/api/dcim/cables/",
    "connected-device": "https://ipam.xxxx.com/api/dcim/connected-device/",
    "console-port-templates": "https://ipam.xxxx.com/api/dcim/console-port-templates/",
    "console-ports": "https://ipam.xxxx.com/api/dcim/console-ports/",
    "console-server-port-templates": "https://ipam.xxxx.com/api/dcim/console-server-port-templates/",
    "console-server-ports": "https://ipam.xxxx.com/api/dcim/console-server-ports/",
    "device-bay-templates": "https://ipam.xxxx.com/api/dcim/device-bay-templates/",
    "device-bays": "https://ipam.xxxx.com/api/dcim/device-bays/",
    "device-roles": "https://ipam.xxxx.com/api/dcim/device-roles/",
    "device-types": "https://ipam.xxxx.com/api/dcim/device-types/",
    "devices": "https://ipam.xxxx.com/api/dcim/devices/",
    "front-port-templates": "https://ipam.xxxx.com/api/dcim/front-port-templates/",
    "front-ports": "https://ipam.xxxx.com/api/dcim/front-ports/",
    "interface-templates": "https://ipam.xxxx.com/api/dcim/interface-templates/",
    "interfaces": "https://ipam.xxxx.com/api/dcim/interfaces/",
    "inventory-item-roles": "https://ipam.xxxx.com/api/dcim/inventory-item-roles/",
    "inventory-item-templates": "https://ipam.xxxx.com/api/dcim/inventory-item-templates/",
    "inventory-items": "https://ipam.xxxx.com/api/dcim/inventory-items/",
    "locations": "https://ipam.xxxx.com/api/dcim/locations/",
    "manufacturers": "https://ipam.xxxx.com/api/dcim/manufacturers/",
    "module-bay-templates": "https://ipam.xxxx.com/api/dcim/module-bay-templates/",
    "module-bays": "https://ipam.xxxx.com/api/dcim/module-bays/",
    "module-types": "https://ipam.xxxx.com/api/dcim/module-types/",
    "modules": "https://ipam.xxxx.com/api/dcim/modules/",
    "platforms": "https://ipam.xxxx.com/api/dcim/platforms/",
    "power-feeds": "https://ipam.xxxx.com/api/dcim/power-feeds/",
    "power-outlet-templates": "https://ipam.xxxx.com/api/dcim/power-outlet-templates/",
    "power-outlets": "https://ipam.xxxx.com/api/dcim/power-outlets/",
    "power-panels": "https://ipam.xxxx.com/api/dcim/power-panels/",
    "power-port-templates": "https://ipam.xxxx.com/api/dcim/power-port-templates/",
    "power-ports": "https://ipam.xxxx.com/api/dcim/power-ports/",
    "rack-reservations": "https://ipam.xxxx.com/api/dcim/rack-reservations/",
    "rack-roles": "https://ipam.xxxx.com/api/dcim/rack-roles/",
    "racks": "https://ipam.xxxx.com/api/dcim/racks/",
    "rear-port-templates": "https://ipam.xxxx.com/api/dcim/rear-port-templates/",
    "rear-ports": "https://ipam.xxxx.com/api/dcim/rear-ports/",
    "regions": "https://ipam.xxxx.com/api/dcim/regions/",
    "site-groups": "https://ipam.xxxx.com/api/dcim/site-groups/",
    "sites": "https://ipam.xxxx.com/api/dcim/sites/",
    "virtual-chassis": "https://ipam.xxxx.com/api/dcim/virtual-chassis/"
}
LoZio commented 2 years ago

Came for the same error, traced to _choice API removed. It seems this project is abandoned since years, so don't hold your breath... See https://github.com/scaleway/netbox-netprod-importer/issues/39

ecoutinho commented 2 years ago

This has worked for me in the past, but haven't tried it for a while:

source /opt/netbox/venv/bin/activate pip uninstall netbox-netprod-importer netboxapi pip install git+https://github.com/scaleway/python-netboxapi.git pip install git+https://github.com/nahun/netbox-netprod-importer.git@options_choices

LoZio commented 2 years ago

Thank you @ecoutinho it worked on a fresh installation!

aruhier commented 2 years ago

Came for the same error, traced to _choice API removed. It seems this project is abandoned since years, so don't hold your breath... See #39

To give some details: I used to work on this project when I was working for Scaleway in the network team. This project was useful to move to Netbox by doing a discovery of the entire fleet. I pushed to opensource it as I found it to be useful for other infrastructures.

I don't work for Scaleway since 2019. The network team, from what I understood, doesn't have someone to dedicate to this project (I don't know if it's still used, from what I heard they did a few quick patches that they kept internal, but I don't know their current usage).

So yes, the approach you should have with this project is to take it as a base that you'll need to adapt for the devices models that you have in your infrastructure, and fix the API changes that happened in Netbox in the last 3 years. I can't really change the README to make it clear and the major things to fix/adapt, as I gave the ownership to Scaleway so I let the decision on them.

LoZio commented 2 years ago

Thank you @aruhier for the details. Generally speaking a discover/map feature should be one of the basic parts of Netbox. Mapping the existing is the base for doing any useful action.