mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Rename connection_status to connected_endpoint_reachable
This commit is contained in:
@@ -30,7 +30,7 @@ from .nested_serializers import *
|
||||
class ConnectedEndpointSerializer(ValidatedModelSerializer):
|
||||
connected_endpoint_type = serializers.SerializerMethodField(read_only=True)
|
||||
connected_endpoint = serializers.SerializerMethodField(read_only=True)
|
||||
connection_status = serializers.SerializerMethodField(read_only=True)
|
||||
connected_endpoint_reachable = serializers.SerializerMethodField(read_only=True)
|
||||
|
||||
def get_connected_endpoint_type(self, obj):
|
||||
if obj._path is not None and obj._path.destination is not None:
|
||||
@@ -48,9 +48,8 @@ class ConnectedEndpointSerializer(ValidatedModelSerializer):
|
||||
return serializer(obj._path.destination, context=context).data
|
||||
return None
|
||||
|
||||
# TODO: Tweak the representation for this field
|
||||
@swagger_serializer_method(serializer_or_field=serializers.BooleanField)
|
||||
def get_connection_status(self, obj):
|
||||
def get_connected_endpoint_reachable(self, obj):
|
||||
if obj._path is not None:
|
||||
return obj._path.is_active
|
||||
return None
|
||||
@@ -467,7 +466,7 @@ class ConsoleServerPortSerializer(TaggedObjectSerializer, ConnectedEndpointSeria
|
||||
model = ConsoleServerPort
|
||||
fields = [
|
||||
'id', 'url', 'device', 'name', 'label', 'type', 'description', 'connected_endpoint_type',
|
||||
'connected_endpoint', 'connection_status', 'cable', 'tags',
|
||||
'connected_endpoint', 'connected_endpoint_reachable', 'cable', 'tags',
|
||||
]
|
||||
|
||||
|
||||
@@ -485,7 +484,7 @@ class ConsolePortSerializer(TaggedObjectSerializer, ConnectedEndpointSerializer)
|
||||
model = ConsolePort
|
||||
fields = [
|
||||
'id', 'url', 'device', 'name', 'label', 'type', 'description', 'connected_endpoint_type',
|
||||
'connected_endpoint', 'connection_status', 'cable', 'tags',
|
||||
'connected_endpoint', 'connected_endpoint_reachable', 'cable', 'tags',
|
||||
]
|
||||
|
||||
|
||||
@@ -513,7 +512,7 @@ class PowerOutletSerializer(TaggedObjectSerializer, ConnectedEndpointSerializer)
|
||||
model = PowerOutlet
|
||||
fields = [
|
||||
'id', 'url', 'device', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description',
|
||||
'connected_endpoint_type', 'connected_endpoint', 'connection_status', 'cable', 'tags',
|
||||
'connected_endpoint_type', 'connected_endpoint', 'connected_endpoint_reachable', 'cable', 'tags',
|
||||
]
|
||||
|
||||
|
||||
@@ -531,7 +530,7 @@ class PowerPortSerializer(TaggedObjectSerializer, ConnectedEndpointSerializer):
|
||||
model = PowerPort
|
||||
fields = [
|
||||
'id', 'url', 'device', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description',
|
||||
'connected_endpoint_type', 'connected_endpoint', 'connection_status', 'cable', 'tags',
|
||||
'connected_endpoint_type', 'connected_endpoint', 'connected_endpoint_reachable', 'cable', 'tags',
|
||||
]
|
||||
|
||||
|
||||
@@ -555,8 +554,8 @@ class InterfaceSerializer(TaggedObjectSerializer, ConnectedEndpointSerializer):
|
||||
model = Interface
|
||||
fields = [
|
||||
'id', 'url', 'device', 'name', 'label', 'type', 'enabled', 'lag', 'mtu', 'mac_address', 'mgmt_only',
|
||||
'description', 'connected_endpoint_type', 'connected_endpoint', 'connection_status', 'cable', 'mode',
|
||||
'untagged_vlan', 'tagged_vlans', 'tags', 'count_ipaddresses',
|
||||
'description', 'connected_endpoint_type', 'connected_endpoint', 'connected_endpoint_reachable', 'cable',
|
||||
'mode', 'untagged_vlan', 'tagged_vlans', 'tags', 'count_ipaddresses',
|
||||
]
|
||||
|
||||
# TODO: This validation should be handled by Interface.clean()
|
||||
@@ -720,7 +719,7 @@ class InterfaceConnectionSerializer(ValidatedModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Interface
|
||||
fields = ['interface_a', 'interface_b', 'connection_status']
|
||||
fields = ['interface_a', 'interface_b']
|
||||
|
||||
@swagger_serializer_method(serializer_or_field=NestedInterfaceSerializer)
|
||||
def get_interface_a(self, obj):
|
||||
|
Reference in New Issue
Block a user