mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
Removed legacy LLDP neighbors API endpoint
This commit is contained in:
parent
0f608f3a15
commit
e85cc0d856
@ -286,29 +286,6 @@ class DeviceViewSet(WritableSerializerMixin, CustomFieldModelViewSet):
|
|||||||
return Response(response)
|
return Response(response)
|
||||||
|
|
||||||
|
|
||||||
@detail_route(url_path='lldp-neighbors')
|
|
||||||
def lldp_neighbors(self, request, pk):
|
|
||||||
"""
|
|
||||||
Retrieve live LLDP neighbors of a device
|
|
||||||
"""
|
|
||||||
device = get_object_or_404(Device, pk=pk)
|
|
||||||
if not device.primary_ip:
|
|
||||||
raise ServiceUnavailable("No IP configured for this device.")
|
|
||||||
|
|
||||||
RPC = device.get_rpc_client()
|
|
||||||
if not RPC:
|
|
||||||
raise ServiceUnavailable("No RPC client available for this platform ({}).".format(device.platform))
|
|
||||||
|
|
||||||
# Connect to device and retrieve inventory info
|
|
||||||
try:
|
|
||||||
with RPC(device, username=settings.NETBOX_USERNAME, password=settings.NETBOX_PASSWORD) as rpc_client:
|
|
||||||
lldp_neighbors = rpc_client.get_lldp_neighbors()
|
|
||||||
except:
|
|
||||||
raise ServiceUnavailable("Error connecting to the remote device.")
|
|
||||||
|
|
||||||
return Response(lldp_neighbors)
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Device components
|
# Device components
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user