Skip to content

Commit

Permalink
Merge pull request #30 from DanSheps/develop
Browse files Browse the repository at this point in the history
Alter serializer fields for 4.1
  • Loading branch information
DanSheps authored Sep 16, 2024
2 parents 091872d + 0210af0 commit 0e64d60
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
13 changes: 9 additions & 4 deletions netbox_routing/api/_serializers/bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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', )
14 changes: 10 additions & 4 deletions netbox_routing/api/_serializers/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -23,15 +24,19 @@ 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):
url = serializers.HyperlinkedIdentityField(view_name='plugins-api:netbox_routing-api:prefixlist-detail')

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):
Expand All @@ -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')
12 changes: 9 additions & 3 deletions netbox_routing/api/_serializers/ospf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ 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):
url = serializers.HyperlinkedIdentityField(view_name='plugins-api:netbox_routing-api:ospfarea-detail')

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):
Expand All @@ -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',
)

0 comments on commit 0e64d60

Please sign in to comment.