?
UNIFI-4
feature
Created: 2026-02-02 Updated: 2026-02-02
Relationships Loading...
Attachments
Loading...
Comments (3)
QA Agent · 2026-02-02
## QA VERIFICATION: ✅ PASSED **All acceptance criteria verified and passing.** ### Test Results - **Test Suite:** 98/98 tests passing (30 new connector tests) - **Execution Time:** 0.28s - **Coverage:** Comprehensive coverage of all proxy functionality ### Acceptance Criteria Status ✅ Proxy request method `_proxy_request()` implemented with all HTTP methods ✅ `--console` option and `UNIFI_CONSOLE` env var working ✅ Console ID requirement enforced with clear error messages ✅ Timeout handling: 5s (health) / 30s (operations) ✅ Site context support via `--site-name` option ✅ Error handling: 404, timeout, connection errors all handled ✅ X-API-Key header forwarding verified ### Test Coverage Highlights - 7 tests for proxy request method behavior - 7 tests for Network API methods via proxy - 15 tests for connector CLI commands - 1 test for timeout constants ### Verified Scenarios 1. ✅ Missing console ID produces clear error 2. ✅ Invalid console ID returns 404 not found 3. ✅ Timeout handling with proper error messages 4. ✅ All connector commands (sites, devices, clients, restart) 5. ✅ JSON/YAML/text output formats 6. ✅ Site name filtering 7. ✅ Console ID override per command ### Code Quality - No security vulnerabilities detected - Proper error handling throughout - Type hints and documentation included - Follows existing codebase patterns - API endpoint format matches documentation ### Files Changed - `unifi_cli.py`: +408 lines - `tests/test_cli.py`: +468 lines **Full QA report:** `/tmp/qa-UNIFI-4.md` **VERDICT:** Implementation is production-ready. No issues found.
agent · 2026-02-02
## Implementation Complete ### What was implemented **Connector Proxy (_proxy_request method):** - Added `_proxy_request()` method in `UniFiClient` class (line 269-337) - Supports all HTTP methods: GET, POST, PUT, PATCH, DELETE - Convenience wrappers: `_proxy_get`, `_proxy_post`, `_proxy_put`, `_proxy_patch`, `_proxy_delete` - Proper error handling with clear error messages for missing console ID - Timeout handling with configurable timeout (default 30s) **CLI Options:** - Added `--console` global option for specifying target console - Environment variable: `UNIFI_CONSOLE` - Per-command override with `--console-id` option **Network API Methods (via proxy):** - `get_network_sites()` - List sites from console - `get_network_devices()` / `get_network_device()` - List/get devices - `get_network_clients()` / `get_network_client()` - List/get clients - `restart_network_device()` - Restart a device **CLI Commands (`connector` group):** - `connector sites` - List network sites - `connector devices` - List devices (with --site-name option) - `connector device <id>` - Get device details - `connector clients` - List clients - `connector client <id>` - Get client details - `connector restart-device <id>` - Restart device **Timeout Constants:** - `TIMEOUT_HEALTH = 5` (5 seconds for health checks) - `TIMEOUT_DEFAULT = 30` (30 seconds for standard operations) ### Test Coverage Added 30 new tests covering: - Proxy request method behavior - Console ID requirement enforcement - Error handling (404, timeout) - All Network API methods via proxy - All connector CLI commands - Console override functionality - Timeout constants ### Verification All 98 tests pass (68 existing + 30 new). ### Files Changed - `unifi_cli.py`: +408 lines - `tests/test_cli.py`: +468 lines ### Usage Examples ```bash # List devices via connector proxy unifi --api-key KEY --console HOST_ID connector devices # Get device details with custom site unifi --api-key KEY --console HOST_ID connector device DEVICE_ID --site-name office # Using environment variables export UNIFI_API_KEY=xxx export UNIFI_CONSOLE=host-123 unifi connector devices --format json ```
triage-agent · 2026-02-02
## Feature Triage Complete **Status:** NOT IMPLEMENTED **Summary:** The connector proxy feature for accessing local Network API through the cloud does not exist in the codebase. The current CLI only supports Site Manager API endpoints directly. **Implementation Location:** - All changes in `unifi_cli.py` - Add `_proxy_request()` method to `UniFiClient` class (~line 263) - Add `--console` CLI option for specifying target console - Add Network API methods that use the proxy **Key Findings:** - API endpoints: `/v1/connector/consoles/{id}/*path` (GET/POST/PUT/PATCH/DELETE) - Console firmware requirement: >= 5.0.3 - Timeouts: 5s for health checks, 30s for operations - No new dependencies required (uses existing `requests` library) **Design Decision:** Recommend adding new `--console` option rather than repurposing existing `--host` option (backward compatible) **Complexity:** Medium See attached triage report: `/tmp/triage-UNIFI-4.md`