Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FHRP group ID is misrepresented on the group assignments API endpoint when brief mode is used #15133

Closed
jeremystretch opened this issue Feb 13, 2024 · 0 comments · Fixed by #15134
Assignees
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@jeremystretch
Copy link
Member

Deployment Type

NetBox Cloud

NetBox Version

v3.7.2

Python Version

3.11

Steps to Reproduce

  1. Create an FHRP group
  2. Assigned FHRP group to a device interface (details are unimportant)
  3. Query the /api/ipam/fhrp-group-assignments/ REST API endpoint
  4. Make a second query to the endpoint, this time using brief mode ?brief=true
  5. Compare the results, specifically the group field

Example results for reference:

Normal mode

{
    "id": 1,
    "url": "http://netbox:8000/api/ipam/fhrp-group-assignments/1/",
    "display": "GigabitEthernet1/0/3: foobar123 VRRPv3: 10 (1)",
    "group": {
        "id": 1,
        "url": "http://netbox:8000/api/ipam/fhrp-groups/1/",
        "display": "foobar123 VRRPv3: 10",
        "protocol": "vrrp3",
        "group_id": 10
    },
    "interface_type": "dcim.interface",
    "interface_id": 172,
    "interface": {
        ...
    },
    "priority": 1,
    "created": "2024-02-13T13:55:10.906366Z",
    "last_updated": "2024-02-13T13:55:10.906373Z"
}

Brief mode

{
    "id": 1,
    "url": "http://netbox:8000/api/ipam/fhrp-group-assignments/1/",
    "display": "GigabitEthernet1/0/3: foobar123 VRRPv3: 10 (1)",
    "interface_type": 39,
    "interface_id": 172,
    "group_id": 1,
    "priority": 1
}

Expected Behavior

The group field should be present in and consistent between both responses.

Observed Behavior

The group field is omitted in the brief mode response, and a group_id field is included instead. Note that this is not the numeric group ID assigned by the user to the FHRP group, but rather the unique database ID for the group object.

@jeremystretch jeremystretch added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation severity: medium Results in substantial degraded or broken functionality for specfic workflows labels Feb 13, 2024
@jeremystretch jeremystretch self-assigned this Feb 13, 2024
jeremystretch added a commit that referenced this issue Feb 13, 2024
…nder brief mode (#15134)

* Fixes #15133: Fix FHRP group representation on assignments endpoint under brief mode

* Update API test
jeremystretch added a commit that referenced this issue Feb 13, 2024
…nder brief mode (#15134)

* Fixes #15133: Fix FHRP group representation on assignments endpoint under brief mode

* Update API test
jeremystretch added a commit that referenced this issue Feb 14, 2024
…ds (#15122)

* Enable dynamic field inclusion for REST API serializers

* Recurse through nested serializer when resolving prefetches

* Remove obsolete calls to prefetch_related() for API views

* Remove support for brief_prefetch_fields viewset attribute

* Rename query parameter

* Fixes #15133: Fix FHRP group representation on assignments endpoint under brief mode (#15134)

* Fixes #15133: Fix FHRP group representation on assignments endpoint under brief mode

* Update API test

* Restore get_queryset() on BriefModeMixin, minus prefetch logic

* get_prefetches_for_serializer() should reference serializer field source if set
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
1 participant