netbox-community / netbox-topology-views

A netbox plugin that draws topology views
Apache License 2.0
696 stars 61 forks source link

API router expects unique names / Export not working #507

Closed dreng closed 2 weeks ago

dreng commented 2 weeks ago

NetBox version

v4.0.4-dev

Topology Views version

v4.0.0-beta.1

Steps to Reproduce

  1. Open netbox_topology_views/api/urls.py and uncomment #router.register("xml-export", views.ExportTopoToXML)
  2. Start debugging

Expected Behavior

NetBox should start without errors.

Observed Behavior

ExportTopoToXML has been commented In the current beta. If you uncomment the line and try to start, you will get an error and NetBox does not start.

Router with basename "device" is already registered. Please provide a unique basename for viewset "<class 'netbox_topology_views.api.views.ExportTopoToXML'>"

This is because the router expects a unique name for the member variable "queryset". If you comment "router.register("save-coords", views.SaveCoordsViewSet)" instead, NetBox starts because "queryset = Device.objects.none()" is used in both router classes. Both use the same basename "Devices" which is not allowed.