mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge release v2.4.7 into develop-2.5
This commit is contained in:
@ -524,13 +524,13 @@ class ConnectedDeviceViewSet(ViewSet):
|
||||
interface. This is useful in a situation where a device boots with no configuration, but can detect its neighbors
|
||||
via a protocol such as LLDP. Two query parameters must be included in the request:
|
||||
|
||||
* `peer-device`: The name of the peer device
|
||||
* `peer-interface`: The name of the peer interface
|
||||
* `peer_device`: The name of the peer device
|
||||
* `peer_interface`: The name of the peer interface
|
||||
"""
|
||||
permission_classes = [IsAuthenticatedOrLoginNotRequired]
|
||||
_device_param = Parameter('peer-device', 'query',
|
||||
_device_param = Parameter('peer_device', 'query',
|
||||
description='The name of the peer device', required=True, type=openapi.TYPE_STRING)
|
||||
_interface_param = Parameter('peer-interface', 'query',
|
||||
_interface_param = Parameter('peer_interface', 'query',
|
||||
description='The name of the peer interface', required=True, type=openapi.TYPE_STRING)
|
||||
|
||||
def get_view_name(self):
|
||||
@ -541,9 +541,15 @@ class ConnectedDeviceViewSet(ViewSet):
|
||||
def list(self, request):
|
||||
|
||||
peer_device_name = request.query_params.get(self._device_param.name)
|
||||
if not peer_device_name:
|
||||
# TODO: remove this after 2.4 as the switch to using underscores is a breaking change
|
||||
peer_device_name = request.query_params.get('peer-device')
|
||||
peer_interface_name = request.query_params.get(self._interface_param.name)
|
||||
if not peer_interface_name:
|
||||
# TODO: remove this after 2.4 as the switch to using underscores is a breaking change
|
||||
peer_interface_name = request.query_params.get('peer-interface')
|
||||
if not peer_device_name or not peer_interface_name:
|
||||
raise MissingFilterException(detail='Request must include "peer-device" and "peer-interface" filters.')
|
||||
raise MissingFilterException(detail='Request must include "peer_device" and "peer_interface" filters.')
|
||||
|
||||
# Determine local interface from peer interface's connection
|
||||
peer_interface = get_object_or_404(Interface, device__name=peer_device_name, name=peer_interface_name)
|
||||
|
Reference in New Issue
Block a user