Skip to content

Update GraphQL to allow query of prefix by location, site, site-group and region #21018

@matthew-242

Description

@matthew-242

NetBox version

v4.4.2

Feature type

New functionality

Proposed functionality

Extend GraphQL query logic for prefixes to mirror the ability in "circuit terminations" to filter on Location, Site, Site-Group and Region.

My testing suggests it is as simple as updating the imports to include the relevant filters:

from dcim.graphql.filters import LocationFilter, RegionFilter, SiteFilter, SiteGroupFilter

And then adding the following:

    _location: Annotated['LocationFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
        strawberry_django.filter_field(name='location')
    )
    _region: Annotated['RegionFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
        strawberry_django.filter_field(name='region')
    )
    _site_group: Annotated['SiteGroupFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
        strawberry_django.filter_field(name='site_group')
    )
    _site: Annotated['SiteFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
        strawberry_django.filter_field(name='site')
    )

Use case

Allows the query of prefixes by location, site, site-group or region.

Database changes

No response

External dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    netboxstatus: needs triageThis issue is awaiting triage by a maintainertype: featureIntroduction of new functionality to the application

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions