Skip to content

Enhance device & link listing with additional filters & ourput columns#2813

Open
juan-malbeclabs wants to merge 5 commits intomainfrom
jo/2653
Open

Enhance device & link listing with additional filters & ourput columns#2813
juan-malbeclabs wants to merge 5 commits intomainfrom
jo/2653

Conversation

@juan-malbeclabs
Copy link
Contributor

@juan-malbeclabs juan-malbeclabs commented Feb 4, 2026

Summary

Add comprehensive filtering capabilities to device list and link list CLI commands
Add desired_status & metrics_publisher_pk field to device list output (hidden from table, visible in JSON)
Add extensive test coverage for all new filters

Changes

Device List Enhancements
New Filters:

--exchange - Filter by exchange (pubkey or code)
--location - Filter by location (pubkey or code)
--device-type - Filter by type (hybrid, transit, edge)
--status - Filter by status (pending, activated, deleting, rejected, drained, device-provisioning, link-provisioning)
--health - Filter by health (unknown, pending, ready-for-links, ready-for-users, impaired)
--desired-status - Filter by desired status (pending, activated, drained)
--code - Filter by device code with partial match
New Field:

Added metrics_publisher_pk to DeviceDisplay struct, marked with #[tabled(skip)] so it appears in JSON output but not in table view
Link List Enhancements
New Filters:

--side-a - Filter by side A device (pubkey or code)
--side-z - Filter by side Z device (pubkey or code)
--link-type - Filter by link type (WAN, DZX) - complements existing --wan and --dzx boolean flags
--status - Filter by status (pending, activated, deleting, rejected, drained)
--health - Filter by health (unknown, pending, ready-for-service, impaired)
--desired-status - Filter by desired status (pending, activated, drained)
--code - Filter by link code with partial match

Filter Behavior

All filters can be combined for complex queries
Exchange, location, and device filters accept both pubkeys and codes
Code filters use partial matching (substring search)
Other filters require exact matches
Invalid filter values return descriptive error messages

Testing

Added comprehensive test coverage:

Device tests: 5 tests covering device_type, code, status, and combined filters
Link tests: 5 tests covering link_type, side_a, code filtering
Examples

Device filtering

doublezero device list --device-type hybrid --status activated
doublezero device list --location ams --health ready-for-users
doublezero device list --code device-001

Link filtering

doublezero link list --link-type WAN --status activated
doublezero link list --side-a device-ams --health ready-for-service
doublezero link list --code production

Combined filters

doublezero device list --location ams --device-type hybrid --status activated

Testing Verification

  1. All existing tests pass (10/10 tests pass)
  2. New filter tests added and passing
  3. Code formatted with make rust-fmt
  4. Filters work individually and in combination
  5. Error messages are descriptive for invalid input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: add desired_status to doublezero device list --json output

1 participant