GraphQL: Filtering FHRP group assignments by device/VM is not available #11254

Closed
opened 2025-12-29 21:42:33 +01:00 by adam · 3 comments
Owner

Originally created by @Leo1003 on GitHub (Jun 4, 2025).

Originally assigned to: @jnovinger on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.3.1

Python Version

3.10

Steps to Reproduce

Originally, it was able to filter FHRP group assignments by device/VM id.
This feature was added by #9314.
However, in the version 4.3.1, Those fields definition are missing in FHRPGroupAssignmentFilter.
And this regression breaks our scripts.

I can even check this issue from the demo site: https://demo.netbox.dev/graphql/

The following GraphQL query works fine in version 4.2, but it causes an error in version 4.3

{
  fhrp_group_assignment_list(filters: {virtual_machine_id: ["22"]}) {
    group {
      id
      ip_addresses {
        address
        dns_name
      }
    }
  }
}

Expected Behavior

Should be able to use device, device_id, virtual_machine, virtual_machine_id to filter FHRPGroupAssignment.

Observed Behavior

The above query return an error:

Field 'virtual_machine_id' is not defined by type 'FHRPGroupAssignmentFilter'.

And those fields are missing from FHRPGroupAssignmentFilter definition.

Originally created by @Leo1003 on GitHub (Jun 4, 2025). Originally assigned to: @jnovinger on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.3.1 ### Python Version 3.10 ### Steps to Reproduce Originally, it was able to filter FHRP group assignments by device/VM id. This feature was added by #9314. However, in the version 4.3.1, Those fields definition are missing in `FHRPGroupAssignmentFilter`. And this regression breaks our scripts. I can even check this issue from the demo site: https://demo.netbox.dev/graphql/ The following GraphQL query works fine in version 4.2, but it causes an error in version 4.3 ```graphql { fhrp_group_assignment_list(filters: {virtual_machine_id: ["22"]}) { group { id ip_addresses { address dns_name } } } } ``` ### Expected Behavior Should be able to use `device`, `device_id`, `virtual_machine`, `virtual_machine_id` to filter FHRPGroupAssignment. ### Observed Behavior The above query return an error: ``` Field 'virtual_machine_id' is not defined by type 'FHRPGroupAssignmentFilter'. ``` And those fields are missing from `FHRPGroupAssignmentFilter` definition.
adam added the type: bugstatus: acceptedtopic: GraphQLseverity: low labels 2025-12-29 21:42:33 +01:00
adam closed this issue 2025-12-29 21:42:33 +01:00
Author
Owner

@jnovinger commented on GitHub (Jun 4, 2025):

@Leo1003 , thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

With respect to the additions in #9314 (which is actually a PR for #8858), these changes are added to the relevant REST API filtersets. As of v4.3, these filtersets are no longer powering filtering in the GraphQL API. As you can see, these filters on the FHRPGroupAssignmentFilterSet are, in fact, still present.

@jnovinger commented on GitHub (Jun 4, 2025): @Leo1003 , thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports. With respect to the additions in #9314 (which is actually a PR for #8858), these changes are added to the relevant REST API filtersets. As of v4.3, these filtersets are no longer powering filtering in the GraphQL API. As you can see, these filters on the `FHRPGroupAssignmentFilterSet` are, in fact, [still present](https://github.com/netbox-community/netbox/blob/main/netbox/ipam/filtersets.py#L838-L857).
Author
Owner

@Leo1003 commented on GitHub (Jun 4, 2025):

After doing some git blame, I think it is introduced by #18701.

The PR makes GraphQL API no longer use filterset, however, it didn't add all the filters back to the GraphQL filter.

The following GraphQL query works fine in version 4.2, but it causes an error in version 4.3

{
  fhrp_group_assignment_list(filters: {virtual_machine_id: ["22"]}) {
    group {
      id
      ip_addresses {
        address
        dns_name
      }
    }
  }
}
Field 'virtual_machine_id' is not defined by type 'FHRPGroupAssignmentFilter'.
@Leo1003 commented on GitHub (Jun 4, 2025): After doing some git blame, I think it is introduced by #18701. The PR makes GraphQL API no longer use filterset, however, it didn't add all the filters back to the GraphQL filter. The following GraphQL query works fine in version 4.2, but it causes an error in version 4.3 ```graphql { fhrp_group_assignment_list(filters: {virtual_machine_id: ["22"]}) { group { id ip_addresses { address dns_name } } } } ``` ``` Field 'virtual_machine_id' is not defined by type 'FHRPGroupAssignmentFilter'. ```
Author
Owner

@jnovinger commented on GitHub (Jun 4, 2025):

Thanks @Leo1003 , and thank you for updating the original report!

@jnovinger commented on GitHub (Jun 4, 2025): Thanks @Leo1003 , and thank you for updating the original report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11254