From 0210af029cbe9828271f1aadbce019c81a1abea0 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Mon, 16 Sep 2024 15:13:32 -0500 Subject: [PATCH] Alter serializer fields for 4.1 --- netbox_routing/api/_serializers/bgp.py | 13 +++++++++---- netbox_routing/api/_serializers/objects.py | 14 ++++++++++---- netbox_routing/api/_serializers/ospf.py | 12 +++++++++--- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/netbox_routing/api/_serializers/bgp.py b/netbox_routing/api/_serializers/bgp.py index f6f7907..b488b69 100644 --- a/netbox_routing/api/_serializers/bgp.py +++ b/netbox_routing/api/_serializers/bgp.py @@ -27,8 +27,10 @@ class BGPSettingSerializer(NetBoxModelSerializer): class Meta: model = BGPSetting fields = ( - 'url', 'id', 'display', 'assigned_object_type', 'assigned_object_id', 'assigned_object', 'key', 'value' + 'url', 'id', 'display', 'assigned_object_type', 'assigned_object_id', 'assigned_object', 'key', 'value', + 'description', 'comments', ) + brief_fields = ('url', 'id', 'display', 'assigned_object', 'key', ) @extend_schema_field(serializers.JSONField(allow_null=True)) def get_assigned_object(self, obj): @@ -49,7 +51,8 @@ class BGPRouterSerializer(NetBoxModelSerializer): class Meta: model = BGPRouter - fields = ('url', 'id', 'display', 'device', 'asn', 'settings') + fields = ('url', 'id', 'display', 'device', 'asn', 'settings', 'description', 'comments',) + fields = ('url', 'id', 'display', 'device', 'asn', ) class BGPScopeSerializer(NetBoxModelSerializer): @@ -62,7 +65,8 @@ class BGPScopeSerializer(NetBoxModelSerializer): class Meta: model = BGPScope - fields = ('url', 'id', 'display', 'router', 'vrf', 'settings') + fields = ('url', 'id', 'display', 'router', 'vrf', 'settings', 'description', 'comments',) + brief_fields = ('url', 'id', 'display', 'router', 'vrf', ) class BGPAddressFamilySerializer(NetBoxModelSerializer): @@ -73,4 +77,5 @@ class BGPAddressFamilySerializer(NetBoxModelSerializer): class Meta: model = BGPAddressFamily - fields = ('url', 'id', 'display', 'scope', 'address_family', 'settings') + fields = ('url', 'id', 'display', 'scope', 'address_family', 'settings', 'description', 'comments',) + brief_fields = ('url', 'id', 'display', 'scope', 'address_family', ) diff --git a/netbox_routing/api/_serializers/objects.py b/netbox_routing/api/_serializers/objects.py index 2fadb02..223b0b5 100644 --- a/netbox_routing/api/_serializers/objects.py +++ b/netbox_routing/api/_serializers/objects.py @@ -14,7 +14,8 @@ class PrefixListSerializer(NetBoxModelSerializer): class Meta: model = PrefixList - fields = ('url', 'id', 'display', 'name') + fields = ('url', 'id', 'display', 'name', 'description', 'comments',) + brief_fields = ('url', 'id', 'display', 'name', ) class PrefixListEntrySerializer(NetBoxModelSerializer): @@ -23,7 +24,10 @@ class PrefixListEntrySerializer(NetBoxModelSerializer): class Meta: model = PrefixListEntry - fields = ('url', 'id', 'display', 'prefix_list', 'sequence', 'type', 'prefix', 'le', 'ge') + fields = ( + 'url', 'id', 'display', 'prefix_list', 'sequence', 'type', 'prefix', 'le', 'ge', 'description', 'comments', + ) + brief_fields = ('url', 'id', 'display', 'prefix_list', 'sequence', 'type', 'prefix', 'le', 'ge') class RouteMapSerializer(NetBoxModelSerializer): @@ -31,7 +35,8 @@ class RouteMapSerializer(NetBoxModelSerializer): class Meta: model = RouteMap - fields = ('url', 'id', 'display', 'name') + fields = ('url', 'id', 'display', 'name', 'description', 'comments',) + brief_fields = ('url', 'id', 'display', 'name') class RouteMapEntrySerializer(NetBoxModelSerializer): @@ -41,4 +46,5 @@ class RouteMapEntrySerializer(NetBoxModelSerializer): class Meta: model = RouteMapEntry - fields = ('url', 'id', 'display', 'route_map', 'sequence', 'type') + fields = ('url', 'id', 'display', 'route_map', 'sequence', 'type', 'description', 'comments',) + brief_fields = ('url', 'id', 'display', 'route_map', 'sequence', 'type') diff --git a/netbox_routing/api/_serializers/ospf.py b/netbox_routing/api/_serializers/ospf.py index 0687525..97fed8e 100644 --- a/netbox_routing/api/_serializers/ospf.py +++ b/netbox_routing/api/_serializers/ospf.py @@ -19,7 +19,8 @@ class OSPFInstanceSerializer(NetBoxModelSerializer): class Meta: model = OSPFInstance - fields = ('url', 'id', 'display', 'name', 'router_id', 'process_id', 'device') + fields = ('url', 'id', 'display', 'name', 'router_id', 'process_id', 'device', 'description', 'comments',) + brief_fields = ('url', 'id', 'display', 'name', 'router_id', 'process_id', 'device') class OSPFAreaSerializer(NetBoxModelSerializer): @@ -27,7 +28,8 @@ class OSPFAreaSerializer(NetBoxModelSerializer): class Meta: model = OSPFArea - fields = ('url', 'id', 'display', 'area_id') + fields = ('url', 'id', 'display', 'area_id', 'description', 'comments',) + brief_fields = ('url', 'id', 'display', 'area_id') class OSPFInterfaceSerializer(NetBoxModelSerializer): @@ -39,5 +41,9 @@ class OSPFInterfaceSerializer(NetBoxModelSerializer): class Meta: model = OSPFInterface fields = ( - 'url', 'id', 'display', 'instance', 'area', 'interface', 'priority', 'bfd', 'authentication', 'passphrase' + 'url', 'id', 'display', 'instance', 'area', 'interface', 'priority', 'bfd', 'authentication', 'passphrase', + 'description', 'comments', + ) + brief_fields = ( + 'url', 'id', 'display', 'instance', 'area', 'interface', )