mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
Rename connection_status to connected_endpoint_reachable
This commit is contained in:
parent
3d34f1cdcb
commit
b846f631a4
@ -61,10 +61,16 @@ All end-to-end cable paths are now cached using the new CablePath model. This al
|
|||||||
### REST API Changes
|
### REST API Changes
|
||||||
|
|
||||||
* Added support for `PUT`, `PATCH`, and `DELETE` operations on list endpoints
|
* Added support for `PUT`, `PATCH`, and `DELETE` operations on list endpoints
|
||||||
|
* circuits.CircuitTermination: Replaced `connection_status` with `connected_endpoint_reachable` (boolean)
|
||||||
* dcim.Cable: Added `custom_fields`
|
* dcim.Cable: Added `custom_fields`
|
||||||
|
* dcim.ConsolePort: Replaced `connection_status` with `connected_endpoint_reachable` (boolean)
|
||||||
|
* dcim.ConsoleServerPort: Replaced `connection_status` with `connected_endpoint_reachable` (boolean)
|
||||||
* dcim.FrontPort: Removed the `trace` endpoint
|
* dcim.FrontPort: Removed the `trace` endpoint
|
||||||
|
* dcim.Interface: Replaced `connection_status` with `connected_endpoint_reachable` (boolean)
|
||||||
* 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.PowerOutlet: Replaced `connection_status` with `connected_endpoint_reachable` (boolean)
|
||||||
* dcim.PowerPanel: Added `custom_fields`
|
* dcim.PowerPanel: Added `custom_fields`
|
||||||
|
* dcim.PowerPort: Replaced `connection_status` with `connected_endpoint_reachable` (boolean)
|
||||||
* dcim.RackReservation: Added `custom_fields`
|
* dcim.RackReservation: Added `custom_fields`
|
||||||
* dcim.RearPort: Removed the `trace` endpoint
|
* dcim.RearPort: Removed the `trace` endpoint
|
||||||
* dcim.VirtualChassis: Added `custom_fields`
|
* dcim.VirtualChassis: Added `custom_fields`
|
||||||
|
@ -77,5 +77,5 @@ class CircuitTerminationSerializer(ConnectedEndpointSerializer):
|
|||||||
model = CircuitTermination
|
model = CircuitTermination
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'circuit', 'term_side', 'site', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info',
|
'id', 'url', 'circuit', 'term_side', 'site', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info',
|
||||||
'description', 'connected_endpoint_type', 'connected_endpoint', 'connection_status', 'cable',
|
'description', 'connected_endpoint_type', 'connected_endpoint', 'connected_endpoint_reachable', 'cable',
|
||||||
]
|
]
|
||||||
|
@ -30,7 +30,7 @@ from .nested_serializers import *
|
|||||||
class ConnectedEndpointSerializer(ValidatedModelSerializer):
|
class ConnectedEndpointSerializer(ValidatedModelSerializer):
|
||||||
connected_endpoint_type = serializers.SerializerMethodField(read_only=True)
|
connected_endpoint_type = serializers.SerializerMethodField(read_only=True)
|
||||||
connected_endpoint = 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):
|
def get_connected_endpoint_type(self, obj):
|
||||||
if obj._path is not None and obj._path.destination is not None:
|
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 serializer(obj._path.destination, context=context).data
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# TODO: Tweak the representation for this field
|
|
||||||
@swagger_serializer_method(serializer_or_field=serializers.BooleanField)
|
@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:
|
if obj._path is not None:
|
||||||
return obj._path.is_active
|
return obj._path.is_active
|
||||||
return None
|
return None
|
||||||
@ -467,7 +466,7 @@ class ConsoleServerPortSerializer(TaggedObjectSerializer, ConnectedEndpointSeria
|
|||||||
model = ConsoleServerPort
|
model = ConsoleServerPort
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'device', 'name', 'label', 'type', 'description', 'connected_endpoint_type',
|
'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
|
model = ConsolePort
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'device', 'name', 'label', 'type', 'description', 'connected_endpoint_type',
|
'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
|
model = PowerOutlet
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'device', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description',
|
'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
|
model = PowerPort
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'device', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description',
|
'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
|
model = Interface
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'device', 'name', 'label', 'type', 'enabled', 'lag', 'mtu', 'mac_address', 'mgmt_only',
|
'id', 'url', 'device', 'name', 'label', 'type', 'enabled', 'lag', 'mtu', 'mac_address', 'mgmt_only',
|
||||||
'description', 'connected_endpoint_type', 'connected_endpoint', 'connection_status', 'cable', 'mode',
|
'description', 'connected_endpoint_type', 'connected_endpoint', 'connected_endpoint_reachable', 'cable',
|
||||||
'untagged_vlan', 'tagged_vlans', 'tags', 'count_ipaddresses',
|
'mode', 'untagged_vlan', 'tagged_vlans', 'tags', 'count_ipaddresses',
|
||||||
]
|
]
|
||||||
|
|
||||||
# TODO: This validation should be handled by Interface.clean()
|
# TODO: This validation should be handled by Interface.clean()
|
||||||
@ -720,7 +719,7 @@ class InterfaceConnectionSerializer(ValidatedModelSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Interface
|
model = Interface
|
||||||
fields = ['interface_a', 'interface_b', 'connection_status']
|
fields = ['interface_a', 'interface_b']
|
||||||
|
|
||||||
@swagger_serializer_method(serializer_or_field=NestedInterfaceSerializer)
|
@swagger_serializer_method(serializer_or_field=NestedInterfaceSerializer)
|
||||||
def get_interface_a(self, obj):
|
def get_interface_a(self, obj):
|
||||||
|
@ -59,12 +59,6 @@ POWERFEED_MAX_UTILIZATION_DEFAULT = 80 # Percentage
|
|||||||
# Cabling and connections
|
# Cabling and connections
|
||||||
#
|
#
|
||||||
|
|
||||||
# Console/power/interface connection statuses
|
|
||||||
CONNECTION_STATUS_CHOICES = [
|
|
||||||
[False, 'Not Connected'],
|
|
||||||
[True, 'Connected'],
|
|
||||||
]
|
|
||||||
|
|
||||||
# Cable endpoint types
|
# Cable endpoint types
|
||||||
CABLE_TERMINATION_MODELS = Q(
|
CABLE_TERMINATION_MODELS = Q(
|
||||||
Q(app_label='circuits', model__in=(
|
Q(app_label='circuits', model__in=(
|
||||||
|
@ -1714,11 +1714,6 @@ class PowerFeedTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
'max_utilization': 50,
|
'max_utilization': 50,
|
||||||
'comments': 'New comments',
|
'comments': 'New comments',
|
||||||
'tags': [t.pk for t in tags],
|
'tags': [t.pk for t in tags],
|
||||||
|
|
||||||
# Connection
|
|
||||||
'cable': None,
|
|
||||||
'connected_endpoint': None,
|
|
||||||
'connection_status': None,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cls.csv_data = (
|
cls.csv_data = (
|
||||||
|
@ -62,8 +62,8 @@ class ChoiceFieldInspector(FieldInspector):
|
|||||||
value_schema = openapi.Schema(type=openapi.TYPE_STRING, enum=choice_value)
|
value_schema = openapi.Schema(type=openapi.TYPE_STRING, enum=choice_value)
|
||||||
|
|
||||||
if set([None] + choice_value) == {None, True, False}:
|
if set([None] + choice_value) == {None, True, False}:
|
||||||
# DeviceType.subdevice_role, Device.face and InterfaceConnection.connection_status all need to be
|
# DeviceType.subdevice_role and Device.face need to be differentiated since they each have
|
||||||
# differentiated since they each have subtly different values in their choice keys.
|
# subtly different values in their choice keys.
|
||||||
# - subdevice_role and connection_status are booleans, although subdevice_role includes None
|
# - subdevice_role and connection_status are booleans, although subdevice_role includes None
|
||||||
# - face is an integer set {0, 1} which is easily confused with {False, True}
|
# - face is an integer set {0, 1} which is easily confused with {False, True}
|
||||||
schema_type = openapi.TYPE_STRING
|
schema_type = openapi.TYPE_STRING
|
||||||
|
Loading…
Reference in New Issue
Block a user