mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
#8157 - Final work on L2VPN model
This commit is contained in:
@@ -11,6 +11,8 @@ __all__ = [
|
||||
'NestedFHRPGroupAssignmentSerializer',
|
||||
'NestedIPAddressSerializer',
|
||||
'NestedIPRangeSerializer',
|
||||
'NestedL2VPNSerializer',
|
||||
'NestedL2VPNTerminationSerializer',
|
||||
'NestedPrefixSerializer',
|
||||
'NestedRIRSerializer',
|
||||
'NestedRoleSerializer',
|
||||
@@ -203,17 +205,17 @@ class NestedL2VPNSerializer(WritableNestedSerializer):
|
||||
class Meta:
|
||||
model = L2VPN
|
||||
fields = [
|
||||
'id', 'url', 'display', 'name', 'type'
|
||||
'id', 'url', 'display', 'identifier', 'name', 'slug', 'type'
|
||||
]
|
||||
|
||||
|
||||
class NestedL2VPNTerminationSerializer(WritableNestedSerializer):
|
||||
url = serializers.HyperlinkedIdentityField(view_name='ipam-api:l2vpn_termination-detail')
|
||||
url = serializers.HyperlinkedIdentityField(view_name='ipam-api:l2vpntermination-detail')
|
||||
l2vpn = NestedL2VPNSerializer()
|
||||
|
||||
class Meta:
|
||||
model = L2VPNTermination
|
||||
fields = [
|
||||
'id', 'url', 'display', 'l2vpn', 'assigned_object'
|
||||
'id', 'url', 'display', 'l2vpn'
|
||||
]
|
||||
|
||||
|
@@ -207,13 +207,14 @@ class VLANSerializer(NetBoxModelSerializer):
|
||||
tenant = NestedTenantSerializer(required=False, allow_null=True)
|
||||
status = ChoiceField(choices=VLANStatusChoices, required=False)
|
||||
role = NestedRoleSerializer(required=False, allow_null=True)
|
||||
l2vpn_termination = NestedL2VPNTerminationSerializer(read_only=True)
|
||||
prefix_count = serializers.IntegerField(read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = VLAN
|
||||
fields = [
|
||||
'id', 'url', 'display', 'site', 'group', 'vid', 'name', 'tenant', 'status', 'role', 'description', 'tags',
|
||||
'custom_fields', 'created', 'last_updated', 'prefix_count',
|
||||
'id', 'url', 'display', 'site', 'group', 'vid', 'name', 'tenant', 'status', 'role', 'description',
|
||||
'l2vpn_termination', 'tags', 'custom_fields', 'created', 'last_updated', 'prefix_count',
|
||||
]
|
||||
|
||||
|
||||
|
@@ -165,7 +165,7 @@ class L2VPNViewSet(NetBoxModelViewSet):
|
||||
|
||||
|
||||
class L2VPNTerminationViewSet(NetBoxModelViewSet):
|
||||
queryset = L2VPNTermination.objects
|
||||
queryset = L2VPNTermination.objects.prefetch_related('assigned_object')
|
||||
serializer_class = serializers.L2VPNTerminationSerializer
|
||||
filterset_class = filtersets.L2VPNTerminationFilterSet
|
||||
|
||||
|
Reference in New Issue
Block a user