netbox-community/netbox-bgp

API does not export Peer-Group Custom Fields

iribarrem opened this issue · 1 comments

NetBox version
3.7.1

Describe the bug
API output JSON for BGP Peer Group does not exports Custom Fields.
Directly on Netbox UI it shows custom fields normally.

To Reproduce
Steps to reproduce the behavior:

  1. Add any custom field to Content Type "BGP > Bgp Peer Group
  2. Go to /api/plugins/bgp/bgppeergroup/
  3. There's no custom fields key on the JSON

Expected behavior
Custom field key containing a dict of custom fields (even with null values)

Screenshots

GET /api/plugins/bgp/bgppeergroup/
HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 1,
            "display": "IX-SP_IPv4",
            "name": "IX-SP_IPv4",
            "description": "IX-SP_IPv4",
            "import_policies": [
                {
                    "id": 3,
                    "url": "https://NETBOX/plugins/bgp/routing-policy/3/",
                    "name": "IX-SP_Route-Servers_IPv4_In",
                    "display": "IX-SP_Route-Servers_IPv4_In",
                    "description": ""
                }
            ],
            "export_policies": [
                {
                    "id": 4,
                    "url": "https://NETBOX/plugins/bgp/routing-policy/4/",
                    "name": "IX-SP_Route-Servers_IPv4_Out",
                    "display": "IX-SP_Route-Servers_IPv4_Out",
                    "description": ""
                }
            ],
            "comments": ""
        }
    ]
}

Additional context
All other plugin objects have custom fields exported normally, as bgp-session or routing-policy

GET /api/plugins/bgp/bgpsession/
HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 1,
            "tags": [],
            "custom_fields": {
                "ebgp_max_hops": null,
                "keep_all_routes": true
            },

fixed via PR