Skip to content

Add tags and Collection filters to NetBox - #152

Merged
shawn149 merged 3 commits into
mainfrom
work/sw/NetBox-Add-Tags-and-Extended-Properties
Oct 21, 2026
Merged

shawn149 merged 3 commits into
mainfrom
work/sw/NetBox-Add-Tags-and-Extended-Properties

Conversation

@shawn149

@shawn149 shawn149 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

📋 Summary

This PR adds NetBox tags to the NetBox plugin and lets its list streams show just the objects in a Collection, based on feedback from WSP. Tiles can now show and filter by tags, a Collection can be built from a single NetBox tag, and a tile bound to that Collection shows live inventory and custom fields for every object in it.

Note

The tags property relies on the new ["array", { "itemShape": "string" }] column shape, which merged in the platform recently. Without it, imported tags land as one string and the Collection editor lists tag combinations instead of single tags.

What's in it:

  • Tags column and Tag(s) filter on Sites, Racks, Devices, Virtual Machines, Prefixes, IP Addresses, VLAN Groups, Circuits and Power Feeds. Selecting several tags returns objects that have all of them, which is NetBox's own tag= behaviour. A hidden tags stream fills the dropdown. Power Feeds applies the filter in its script, because NetBox GraphQL can't require several tags at once.
  • Object filters (Site(s), Rack(s), Device(s), Virtual machine(s), Prefix(es) and Circuit(s)) on the six imported types, sent to NetBox as repeated id= keys. To show a Collection, bind the filter to a dashboard variable based on that Collection (multi-select, default all).
  • netboxTags property on all six imported object types, stored as a multi-valued property. The graph reserves tags for its own use, hence the different name.
  • Version 1.1.0 and README updates.

The Tags column is named tags.0.display on purpose. Declaring a column called tags stops expandInnerObjects flattening the array, so the column reuses one of the flattened columns, the same way the plugin already reuses site.url. Its valueExpression returns JSON.stringify(names), because the array shape expects a serialised list.

🧩 Plugin details

  • Plugin name: NetBox
  • Type of change:
    • Bug fix
    • New datastream
    • Enhancement to existing datastream
    • Performance improvement
    • Documentation / metadata / logo
    • Other (please describe):

🧪 Testing

I deployed it to a Dev SquaredUp organization and tested against demo.netbox.dev, with test tags and custom fields added by a script.

  • List streams: row counts match NetBox's count and the Tags column matches the raw tags. The Tag(s) filter returns the right objects with AND semantics (Alpha gives 1 site, Golf gives 4, both give 1), including Power Feeds combined with its Site filter.
  • Object filters: each one returns every row when empty and only the selected object's row for each of two different objects.
  • Collections: a Collection of devices tagged SQ Core, bound through a dashboard variable, showed exactly its 8 devices in the Dev UI.
  • Import: all six import steps succeed and netboxTags is stored as a list. A scope matching netboxTags equals "SQ Production" returned 35 objects across the six types, and the Collection editor's NetboxTags filter lists single tags.
  • Validation: squaredup validate passes.

⚠️ Breaking changes

Does this PR introduce any breaking changes?

  • No
  • Yes (please describe):

All new parameters are optional and default to no filter, and the out-of-the-box dashboards are unchanged. Existing data sources pick up netboxTags at their next import.

📚 Documentation

  • Documentation updated
  • No documentation changes needed

✅ Checklist

  • This PR changes a single plugin only
  • No secrets or credentials included
  • Plugin, datastream and UI naming follow SquaredUp guidelines
  • I agree to the Code of Conduct

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added NetBox tag filtering across sites, racks, devices, virtual machines, prefixes, circuits, IP addresses, VLAN groups, and power feeds.
    • Added multi-select tag controls with autocomplete and support for custom tag values.
    • Added a tag data source for consistent tag selection.
    • NetBox results now expose tags as searchable, structured fields and support tag-based indexing.
  • Documentation
    • Documented tag filtering, collections, indexing, live object filters, and related limitations.

Expose tags on NetBox inventory streams, add multi-tag filtering and selectable object filters, and index tags for Collections. Update the plugin documentation and version to 1.1.0.
Update tag columns across NetBox streams to return arrays, enabling tags to be handled individually in Collections. Update the plugin documentation to reflect the new tag behavior.
@shawn149
shawn149 requested a review from a team October 20, 2026 15:04
@shawn149 shawn149 added the enhancement New feature or request label Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository UI (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 1beeb7d1-6a33-419b-b04b-52a8bb6622e9
📥 Commits

Reviewing files that changed from the base of the PR and between d3665e5 and 30eeadf.

📒 Files selected for processing: 1
  • plugins/NetBox/v1/metadata.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: e7154a5b-0c54-4b5a-ae23-a8decaca2cb8
📥 Commits

Reviewing files that changed from the base of the PR and between cdcfc91 and d3665e5.

📒 Files selected for processing: 15
  • plugins/NetBox/v1/dataStreams/circuits.json
  • plugins/NetBox/v1/dataStreams/devices.json
  • plugins/NetBox/v1/dataStreams/ipAddresses.json
  • plugins/NetBox/v1/dataStreams/powerFeeds.json
  • plugins/NetBox/v1/dataStreams/prefixes.json
  • plugins/NetBox/v1/dataStreams/racks.json
  • plugins/NetBox/v1/dataStreams/scripts/powerFeeds.js
  • plugins/NetBox/v1/dataStreams/scripts/tags.js
  • plugins/NetBox/v1/dataStreams/sites.json
  • plugins/NetBox/v1/dataStreams/tags.json
  • plugins/NetBox/v1/dataStreams/virtualMachines.json
  • plugins/NetBox/v1/dataStreams/vlanGroups.json
  • plugins/NetBox/v1/docs/README.md
  • plugins/NetBox/v1/indexDefinitions/default.json
  • plugins/NetBox/v1/metadata.json

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📝 Walkthrough

NetBox data streams now retrieve tag data, provide tag and object filters, and expose aggregated tag metadata. The index mappings and documentation include tag-based filtering and Collections.

Changes: NetBox tag support

Layer / File(s) Summary
Tag option source
plugins/NetBox/v1/dataStreams/tags.json, plugins/NetBox/v1/dataStreams/scripts/tags.js
A hidden Inventory data stream retrieves tags and maps each name and slug to label and value fields.
Tag and object filters
plugins/NetBox/v1/dataStreams/*.json, plugins/NetBox/v1/dataStreams/scripts/powerFeeds.js
Supported data streams request tags and add optional tag or object filters. Tag inputs are normalized, and power feed results are filtered to feeds that match every selected tag slug.
Tag metadata and indexing
plugins/NetBox/v1/dataStreams/*.json, plugins/NetBox/v1/indexDefinitions/default.json, plugins/NetBox/v1/docs/README.md, plugins/NetBox/v1/metadata.json
Data streams expose aggregated tag names and hide raw tag fields. Index mappings add netboxTags for supported objects. The documentation describes tag filtering, indexing, and related limitations. The plugin version changes to 1.1.0.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TagsDataStream
  participant NetBoxAPI
  participant SitesDataStream
  User->>TagsDataStream: Request tag options
  TagsDataStream->>NetBoxAPI: GET /api/extras/tags/
  NetBoxAPI-->>TagsDataStream: Return tag names and slugs
  User->>SitesDataStream: Select tags for filtering
  SitesDataStream->>NetBoxAPI: Send selected tag values with site request
  NetBoxAPI-->>SitesDataStream: Return site records
Loading

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to d3665

This adds optional tag columns and filters to the NetBox plugin. Existing behavior is unchanged when no filter is set. No concrete merge-blocking risk was found.

Architecture risk: 🔵 Low · up to d3665

The change affects 1 system.

Changed systems: plugins

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — plugins (service) was modified; 15 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in plugins/NetBox/v1/dataStreams/circuits.json: The requested fields now include tags; new id and tag query arguments filter by selected circuit raw IDs and normalized tag values, respectively.
  • observed — Modified behavior in plugins/NetBox/v1/dataStreams/circuits.json: Added optional circuit object selection and multi-select tag autocomplete controls, including data-stream-backed tag options and custom-value support.
  • observed — Modified behavior in plugins/NetBox/v1/dataStreams/circuits.json: Added hidden matching for raw tag fields and a tags.0.display metadata field that collects up to 100 non-empty tag names into a JSON array.
  • observed — Modified behavior in plugins/NetBox/v1/dataStreams/devices.json: The requested device fields now include tags; the existing device ID query parameter remains alongside the expanded field list.
Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely summarizes the main changes: adding tags and Collection filters to the NetBox plugin.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description is complete and relevant. It documents the enhancement scope, testing, breaking-change assessment, documentation updates, checklist status, implementation details, and pla…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files. (13 skipped: 13 unsupported.)

Full details: Description check

Explanation

The pull request description is complete and relevant. It documents the enhancement scope, testing, breaking-change assessment, documentation updates, checklist status, implementation details, and platform dependency for the existing NetBox plugin.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

🧩 Plugin PR Summary

📦 Modified Plugins

  • plugins/NetBox/v1

📋 Results

Step Status
Scope & version ✅ Passed
Validation ✅ Passed
Deployment 🚀 Deployed

🔍 Validation Details

✅ netbox
{
  "valid": true,
  "pluginName": "netbox",
  "pluginType": "hybrid",
  "summary": {
    "Data Streams": 18,
    "Import Definitions": 1,
    "Correlation Rules": 0,
    "UI Configuration": true,
    "Has Icon": true,
    "Has Default Content": true,
    "Config Validation": true,
    "Custom Types": true
  }
}

@shawn149
shawn149 requested a review from clarkd October 21, 2026 12:41
@shawn149
shawn149 merged commit 4543553 into main Oct 21, 2026
1 check passed
@shawn149
shawn149 deleted the work/sw/NetBox-Add-Tags-and-Extended-Properties branch October 21, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants