feat: add wireless profile management API#921
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #921 +/- ##
==========================================
+ Coverage 41.66% 42.91% +1.24%
==========================================
Files 135 138 +3
Lines 12433 13064 +631
==========================================
+ Hits 5180 5606 +426
- Misses 6698 6903 +205
Partials 555 555 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a wireless profile management API to the device management surface, wiring new WSMAN operations through the devices usecase and exposing HTTP/OpenAPI endpoints backed by request validation.
Changes:
- Extend WSMAN
Management+ devicesFeatureinterfaces to support WiFi profile CRUD-like operations (list/apply) and IEEE802.1x dependencies. - Add devices usecase implementation for
GetWirelessProfiles/ApplyWirelessProfiles, including certificate/credential handling for 802.1x. - Introduce DTO request type + custom validators and register them in the HTTP router; add HTTP routes, mocks, and tests.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/usecase/devices/wsman/interfaces.go | Expands WSMAN management interface with WiFi profile + 802.1x/cert helpers. |
| internal/usecase/devices/wifistate.go | Import cleanup (no functional change). |
| internal/usecase/devices/wifistate_test.go | Import cleanup (no functional change). |
| internal/usecase/devices/wifiprofile.go | New usecase logic to list/apply wireless profiles, map 802.1x associations, and manage cert handles. |
| internal/usecase/devices/wifiprofile_test.go | New usecase tests for list/apply flows. |
| internal/usecase/devices/wifiprofile_private_test.go | New unit tests for internal mapping/handle-resolution helpers. |
| internal/usecase/devices/interfaces.go | Adds GetWirelessProfiles/ApplyWirelessProfiles to the devices feature interface. |
| internal/mocks/wsv1_mocks.go | Updates WS v1 mocks for new feature methods. |
| internal/mocks/wsman_mocks.go | Updates WSMAN mocks with new management methods. |
| internal/mocks/devicemanagement_mocks.go | Updates device management feature mocks for new API methods. |
| internal/entity/dto/v1/wifiprofile.go | Adds WirelessProfilesApplyRequest and custom validators for wireless profile payloads. |
| internal/entity/dto/v1/wifiprofile_test.go | Adds tests for new validators. |
| internal/controller/ws/v1/interface.go | Extends WS interface with wireless profile operations. |
| internal/controller/openapi/devicemanagement.go | Adds OpenAPI route definitions + example handlers for wireless profiles. |
| internal/controller/httpapi/v1/wifiprofile.go | Adds HTTP handlers for get/apply wireless profiles. |
| internal/controller/httpapi/v1/wifiprofile_test.go | Adds route tests for wireless profile endpoints. |
| internal/controller/httpapi/v1/devicemanagement.go | Registers new WiFi profile routes under /amt/networkSettings/wireless/profile/:guid. |
| internal/controller/httpapi/router.go | Refactors and centralizes custom validator registration; registers new wireless-profile validators. |
| integration-test/collections/console_mps_apis.postman_collection.json | Adds Postman collection entries for the new endpoints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
66c8f6e to
ef25e79
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ef25e79 to
f4e17e6
Compare
f4e17e6 to
2b73759
Compare
19b6fcc to
2ea3109
Compare
|
2ea3109 to
ac1a829
Compare
All sensitive fields have been removed. [
{
"profileName": "WiAMT1",
"ssid": "TP-Link_WiAMT",
"authenticationMethod": "WPAPSK",
"encryptionMethod": "CCMP",
"priority": 10
},
{
"profileName": "CorpEAP1",
"ssid": "CorpNet1",
"authenticationMethod": "WPAIEEE8021x",
"encryptionMethod": "CCMP",
"priority": 30,
"ieee8021x": {
"username": "corpuser1",
"authenticationProtocol": 2
}
}
]
|
Add CRUD wireless profile management to the device surface so operators
can list, create, update, and delete Intel AMT WiFi endpoint profiles
(including 802.1x/EAP profiles) directly through Console instead of
hand-driving WSMAN.
New HTTP routes under networkSettings/wireless/profile/{guid} are
backed by a devices usecase that talks to extended WSMAN Management
operations: it reads existing WiFi and CIM IEEE 802.1x settings,
resolves their concrete dependencies, and applies adds/updates while
enforcing profile-name and priority uniqueness. For 802.1x profiles the
usecase reconciles client/root certificates and private keys against the
device, reusing existing credential handles when present and adding them
otherwise, with a short pause to let AMT settle certificate handling
before the profile is applied.
Read responses are sanitized: passwords, CACert, ClientCert, and
PrivateKey are never returned, only non-sensitive fields (profile name,
SSID, auth/encryption method, priority, and 802.1x username/auth
protocol). Request payloads are guarded by custom validators wired into
the HTTP router, and the new endpoints are folded into the OpenAPI spec
generation flow alongside regenerated mocks, unit tests, and integration
tests covering the read/add/update/delete paths.
Depends on go-wsman-messages#686 for the update-WiFi-settings message.
Refs #834
2687c64 to
6392a84
Compare
sudhir-intc
left a comment
There was a problem hiding this comment.
Thanks for handling the scenario when wifi adapter is missing.
LGTM, please merge post the CI checks pass.
Change Summary
NOTE:
Testing
Sample test data:
Test cases