Skip to content

Commit

Permalink
fix(snmp): Enhance API output
Browse files Browse the repository at this point in the history
Enhanced the /api/plugins/cmdb/snmp/ endpoint to include detailed information for devices and communities, not just the primary key (pk).
  • Loading branch information
cpaillet committed Jun 11, 2024
1 parent 8fa2862 commit 58d232a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions netbox_cmdb/netbox_cmdb/api/snmp/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from rest_framework.serializers import ModelSerializer

from netbox_cmdb.models.snmp import SNMP, SNMPCommunity
from netbox_cmdb.api.common_serializers import CommonDeviceSerializer


class SNMPCommunitySerializer(ModelSerializer):
Expand All @@ -12,8 +13,18 @@ class Meta:
fields = "__all__"


class SNMPCommunitySimpleSerializer(ModelSerializer):

class Meta:
model = SNMPCommunity
fields = ["community", "type"]


class SNMPSerializer(ModelSerializer):

device = CommonDeviceSerializer()
community_list = SNMPCommunitySimpleSerializer(many=True)

class Meta:
model = SNMP
fields = "__all__"

0 comments on commit 58d232a

Please sign in to comment.