Closed
Description
ISSUE TYPE
- Feature Idea
SUMMARY
NetBox support Lookup Expressions filters for almost every field: API Filtering.
From NetBox documentation:
These lookup expressions can be applied by adding a suffix to the desired field's name. E.g. mac_address__n. In this case, the filter expression is for negation and it is separated by two underscores. Below are the lookup expressions that are supported across different field types.
It can't be used in netbox inventory because list of available field names is hardcoded in netbox.py:
ALLOWED_DEVICE_QUERY_PARAMETERS = (
"asset_tag",
"cluster_id",
<...skipped...>
"tenant_id",
"virtual_chassis_id",
)
I think possible workaround is to add suffixes to ALLOWED_DEVICE_QUERY_PARAMETERS check, like this:
370c370
< if not (k in ALLOWED_DEVICE_QUERY_PARAMETERS or k.startswith("cf_")):
---
> if not (k in ALLOWED_DEVICE_QUERY_PARAMETERS or k.startswith("cf_") or k.endswith("__n", "__lt", "__lte", "__gt", "__gte", "__n", "__ic", "__nic", "__isw", "__nisw", "__iew", "__niew", "__ie", "__nie")):
Metadata
Metadata
Assignees
Labels
No labels