Skip to content

Unable to query devices with primary-ip set in GraphQL - "Cannot resolve keyword 'assigned_object_id' into field" #20466

@dxks

Description

@dxks

NetBox Edition

NetBox Community

NetBox Version

v4.4.1

Python Version

3.12

Steps to Reproduce

  1. Create a simple GraphQL-query, i.e.
    query { device_list(filters:{primary_ip4:{assigned:true}}) { id primary_ip4 { assigned_object {__typename} } } }

  2. encounter the error:
    { "data": null, "errors": [ { "message": "Cannot resolve keyword 'assigned_object_id' into field. Choices are: airflow, asset_tag, bgpsession, bookmarks, cabletermination, cluster, cluster_id, comments, config_template, config_template_id, console_port_count, console_server_port_count, consoleports, consoleserverports, contacts, created, custom_field_data, description, designated_arp_router_peering_services, device_bay_count, device_type, device_type_id, devicebays, face, front_port_count, frontports, id, images, interface_count, interfaces, internet_exchange_points, inventory_item_count, inventoryitems, journal_entries, last_updated, latitude, local_context_data, location, location_id, longitude, module_bay_count, modulebays, modules, name, oob_ip, oob_ip_id, parent_bay, peering_services, platform, platform_id, position, power_outlet_count, power_port_count, poweroutlets, powerports, primary_ip4, primary_ip4_id, primary_ip6, primary_ip6_id, rack, rack_id, rear_port_count, rearports, role, role_id, sbfd_discriminator, serial, services, site, site_id, status, subscriptions, tagged_items, tags, tenant, tenant_id, termination_a_device, termination_z_device, vc_master_for, vc_position, vc_priority, vdcs, virtual_chassis, virtual_chassis_id, virtual_machines", "locations": [ { "line": 2, "column": 3 } ], "path": [ "device_list" ] } ] }

Expected Behavior

As the filter has_primary_ip is no longer available (like cabled within InterfaceFilter) I tried the assigned-filter like I do for the connected as a replacement for cabled.

I expected that this would work in the same way and provides a list of devices with a primary ip set.

Observed Behavior

Unfortunately the assigned-filter is applied to the device instead of the Interface and causes the error that it cannot be resolved to a field - as the assigned_object_id is on the interface, not the device.

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtopic: GraphQLtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions