1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add /trace API endpoints for CircuitTermination and PowerFeed

This commit is contained in:
Jeremy Stretch
2020-10-08 13:55:29 -04:00
parent 0c5efa243d
commit 0e41bc48b7
3 changed files with 7 additions and 3 deletions

View File

@ -62,6 +62,7 @@ All end-to-end cable paths are now cached using the new CablePath model. This al
* Added support for `PUT`, `PATCH`, and `DELETE` operations on list endpoints (bulk update and delete) * Added support for `PUT`, `PATCH`, and `DELETE` operations on list endpoints (bulk update and delete)
* circuits.CircuitTermination: * circuits.CircuitTermination:
* Added the `/trace/` endpoint
* Replaced `connection_status` with `connected_endpoint_reachable` (boolean) * Replaced `connection_status` with `connected_endpoint_reachable` (boolean)
* Added `cable_peer` and `cable_peer_type` * Added `cable_peer` and `cable_peer_type`
* dcim.Cable: Added `custom_fields` * dcim.Cable: Added `custom_fields`
@ -81,7 +82,9 @@ All end-to-end cable paths are now cached using the new CablePath model. This al
* Added `cable_peer` and `cable_peer_type` * Added `cable_peer` and `cable_peer_type`
* Removed `connection_status` from nested serializer * Removed `connection_status` from nested serializer
* dcim.InventoryItem: The `_depth` field has been added to reflect MPTT positioning * dcim.InventoryItem: The `_depth` field has been added to reflect MPTT positioning
* dcim.PowerFeed: Add fields `connected_endpoint`, `connected_endpoint_type`, `connected_endpoint_reachable`, `cable_peer`, and `cable_peer_type` * dcim.PowerFeed:
* Added the `/trace/` endpoint
* Added fields `connected_endpoint`, `connected_endpoint_type`, `connected_endpoint_reachable`, `cable_peer`, and `cable_peer_type`
* dcim.PowerOutlet: * dcim.PowerOutlet:
* Replaced `connection_status` with `connected_endpoint_reachable` (boolean) * Replaced `connection_status` with `connected_endpoint_reachable` (boolean)
* Added `cable_peer` and `cable_peer_type` * Added `cable_peer` and `cable_peer_type`

View File

@ -3,6 +3,7 @@ from rest_framework.routers import APIRootView
from circuits import filters from circuits import filters
from circuits.models import Provider, CircuitTermination, CircuitType, Circuit from circuits.models import Provider, CircuitTermination, CircuitType, Circuit
from dcim.api.views import PathEndpointMixin
from extras.api.views import CustomFieldModelViewSet from extras.api.views import CustomFieldModelViewSet
from utilities.api import ModelViewSet from utilities.api import ModelViewSet
from . import serializers from . import serializers
@ -57,7 +58,7 @@ class CircuitViewSet(CustomFieldModelViewSet):
# Circuit Terminations # Circuit Terminations
# #
class CircuitTerminationViewSet(ModelViewSet): class CircuitTerminationViewSet(PathEndpointMixin, ModelViewSet):
queryset = CircuitTermination.objects.prefetch_related( queryset = CircuitTermination.objects.prefetch_related(
'circuit', 'site', '_path__destination', 'cable' 'circuit', 'site', '_path__destination', 'cable'
) )

View File

@ -614,7 +614,7 @@ class PowerPanelViewSet(ModelViewSet):
# Power feeds # Power feeds
# #
class PowerFeedViewSet(CustomFieldModelViewSet): class PowerFeedViewSet(PathEndpointMixin, CustomFieldModelViewSet):
queryset = PowerFeed.objects.prefetch_related( queryset = PowerFeed.objects.prefetch_related(
'power_panel', 'rack', '_path__destination', 'cable', '_cable_peer', 'tags' 'power_panel', 'rack', '_path__destination', 'cable', '_cable_peer', 'tags'
) )