Skip to content

feat(api): add wireless local and UEFI profile sync endpoints#1063

Open
shaoboon wants to merge 1 commit into
mainfrom
sb_wifisync
Open

feat(api): add wireless local and UEFI profile sync endpoints#1063
shaoboon wants to merge 1 commit into
mainfrom
sb_wifisync

Conversation

@shaoboon

@shaoboon shaoboon commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Add GET/POST endpoints to read and toggle AMT wireless profile synchronization on a device:

GET/POST /api/v1/amt/networkSettings/wireless/profileSync/{guid}

The use case drives the WiFiPortConfigurationService over WSMAN, reading current state and only issuing a PUT when the requested value differs. UEFI sync is gated on the device's
UEFIWiFiCoExistenceAndProfileShare power capability so unsupported hardware can't be enabled.

Wires the new methods through the devices.Feature and ws/v1.Feature interfaces, regenerates mocks, declares the routes in the Fuego OpenAPI adapter, and adds matching entries to the MPS Postman collection. Covered by handler and use-case unit tests.

Resolves #835

NOTES:

On-target Functional Test

Functional Postman/Newman corpus for the WiFi Profile Sync feature in Console. The
objective is to exercise the behavior of the API (every logic branch in the use
case), not merely the request contract.

Files

File Purpose
wireless_profile_sync.postman_collection.json The requests + assertions
wireless_profile_sync.postman_environment.json Host, credentials, device GUID, capture vars

Endpoints under test

Method Path Behavior
GET /api/v1/amt/networkSettings/wireless/profileSync/{guid} Read profile sync settings
POST /api/v1/amt/networkSettings/wireless/profileSync/{guid} Update profile sync settings

Pre-requisites

  • console app is running
  • 2 devices provisioned and guid captured
    • device1: with wifi adapter
    • device2: without wifi adapter
  • newman installed

How to run

# Modify the value of following keys in the environment file
# - protocol
# - host
# - consoleUser
# - consolePass
# - deviceId
# - noWifiDeviceId

# Execute newman test
newman run console_wifi_profile_sync.postman_collection.json \
  -e console_wifi_profile_sync.postman_environment.json

Test cases

# Request Body Asserts
10 POST profile sync, localProfileSync as string {"localProfileSync":"yes"} 400
11 POST profile sync, uefiProfileSync as number {"uefiProfileSync":1} 400
20 GET profile sync on no-WiFi device 404
21 POST profile sync on no-WiFi device (valid body) {"localProfileSync":true} 404
00 Get current profile sync 200, well-formed object; captures uefiProfileSyncSupporteduefiSupported
01 Disable local profile sync — POST {"localProfileSync":false} 200, localProfileSync=false
01 Verify local sync disabled (GET after settle) 200, read-back localProfileSync=false
02 Enable local profile sync — POST {"localProfileSync":true} 200, localProfileSync=true
02 Verify local sync enabled (GET after settle) 200, read-back localProfileSync=true
03 Enable UEFI profile sync (capability-aware) — POST {"uefiProfileSync":true} 200 + uefiProfileSync=true if uefiSupported, else 409
04 Disable UEFI profile sync (always allowed) — POST {"uefiProfileSync":false} 200, uefiProfileSync=false
05 No-op update (omit both fields) — POST {} 200, values unchanged (local on, UEFI off)
05b Null field treated as omitted — POST {"localProfileSync":null,"uefiProfileSync":null} 200, values unchanged (parity: MPS == Console)
06 Verify final state (GET after settle) 200, localProfileSync=true, uefiProfileSync=false

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 35.03401% with 191 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.44%. Comparing base (fe3c5f0) to head (01a4939).

Files with missing lines Patch % Lines
internal/controller/openapi/devicemanagement.go 0.00% 117 Missing ⚠️
internal/mocks/devicemanagement_mocks.go 0.00% 28 Missing ⚠️
internal/mocks/wsv1_mocks.go 0.00% 28 Missing ⚠️
internal/mocks/wsman_mocks.go 0.00% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1063      +/-   ##
==========================================
+ Coverage   43.39%   43.44%   +0.04%     
==========================================
  Files         141      143       +2     
  Lines       13397    13621     +224     
==========================================
+ Hits         5814     5917     +103     
- Misses       7022     7143     +121     
  Partials      561      561              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds /api/v1 endpoints to read/toggle AMT wireless profile synchronization settings (Local Profile Sync + UEFI Profile Share) by driving WiFiPortConfigurationService over WSMAN, and wires the feature through interfaces, OpenAPI declarations, mocks, Postman collection, and unit tests.

Changes:

  • Introduces use-case methods and WSMAN interface support for GET/PUT on WiFiPortConfigurationService to manage local/UEFI WiFi profile sync flags.
  • Adds new v1 Gin handlers + DTOs for enabled payloads, plus OpenAPI (Fuego) route declarations.
  • Updates generated mocks and extends the MPS Postman collection; adds handler/use-case/DTO unit tests.

Reviewed changes

Copilot reviewed 12 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
internal/usecase/devices/wsman/interfaces.go Extends WSMAN Management interface with WiFi port config service GET/PUT.
internal/usecase/devices/wifiprofilesync.go New use-case implementation for local + UEFI profile sync toggles.
internal/usecase/devices/wifiprofilesync_test.go Unit tests for new use-case behavior.
internal/usecase/devices/interfaces.go Adds new feature methods to devices use-case interface.
internal/mocks/wsv1_mocks.go Regenerated mocks for ws/v1 feature interface changes.
internal/mocks/wsman_mocks.go Regenerated WSMAN mocks for new management methods.
internal/mocks/devicemanagement_mocks.go Regenerated device management feature mocks for new methods.
internal/entity/dto/v1/wifiprofilesync.go New DTO request/response for { "enabled": <bool> }.
internal/entity/dto/v1/wifiprofilesync_test.go Unit tests for DTO JSON unmarshalling and helper.
internal/controller/ws/v1/interface.go Adds new methods to ws/v1 Feature interface.
internal/controller/openapi/devicemanagement.go Declares new endpoints in Fuego/OpenAPI adapter.
internal/controller/httpapi/v1/wifiprofilesync.go Adds Gin handlers for the new endpoints.
internal/controller/httpapi/v1/wifiprofilesync_test.go Handler unit tests for the new routes.
internal/controller/httpapi/v1/devicemanagement.go Registers new routes under /api/v1/amt/networkSettings/wireless/*.
integration-test/collections/console_mps_apis.postman_collection.json Adds Postman requests for the new endpoints.
Files not reviewed (3)
  • internal/mocks/devicemanagement_mocks.go: Language not supported
  • internal/mocks/wsman_mocks.go: Language not supported
  • internal/mocks/wsv1_mocks.go: Language not supported

Comment thread internal/controller/httpapi/v1/wifiprofilesync.go
Comment thread internal/controller/httpapi/v1/wifiprofilesync.go Outdated
Comment thread internal/entity/dto/v1/wifiprofilesync.go Outdated
Comment thread internal/entity/dto/v1/wifiprofilesync.go Outdated
Comment thread internal/usecase/devices/wifiprofilesync.go Outdated
Comment thread internal/usecase/devices/wifiprofilesync.go Outdated
Comment thread internal/controller/httpapi/v1/wifiprofilesync_test.go
@madhavilosetty-intel

Copy link
Copy Markdown
Contributor

@shaoboon : This is how I'd shape these api's

GET /api/v1/amt/networkSettings/wireless/profileSync/:guid

// Response
{ 
   "localProfileSync": true, 
   "uefiProfileSync": false, 
   "uefiProfileSyncSupported": true  // Read-only (from powerCapabilities.UEFIWiFiCoExistenceAndProfileShare)
}

POST /api/v1/amt/networkSettings/wireless/profileSync/:guid

// Request
type WirelessProfileSyncRequest struct {
    LocalProfileSync *bool `json:"localProfileSync"`
    UEFIProfileSync  *bool `json:"uefiProfileSync"`
}
// Response = same shape as GET
{ "localProfileSync": true, "uefiProfileSync": false, "uefiProfileSyncSupported": true }
  • Check support before writing to AMT. (as you are doing now)
  • On unsupported device (AMT < 16) with uefiProfileSync: true → return 409, reject the entire request (don't apply localProfileSync either — no partial update).
  • If supported, or only localProfileSync is changing → apply and return 200.
  • Response uses the GET response shape.

@shaoboon shaoboon force-pushed the sb_wifisync branch 4 times, most recently from cbd5345 to 35262b9 Compare June 12, 2026 09:31
Add GET/POST endpoints to read and toggle AMT wireless profile
synchronization on a device:

  GET/POST /api/v1/amt/networkSettings/wireless/profileSync/{guid}

The use case drives the WiFiPortConfigurationService over WSMAN,
reading current state and only issuing a PUT when the requested
value differs. UEFI sync is gated on the device's
UEFIWiFiCoExistenceAndProfileShare power capability so unsupported
hardware can't be enabled.

Wires the new methods through the devices.Feature and ws/v1.Feature
interfaces, regenerates mocks, declares the routes in the Fuego
OpenAPI adapter, and adds matching entries to the MPS Postman
collection. Covered by handler and use-case unit tests.

Resolves #835
@madhavilosetty-intel

Copy link
Copy Markdown
Contributor

@shaoboon

  1. Tested on AMT 19:
curl -s -m 30 -w "\nHTTP %{http_code}\n" \
    http://localhost:8181/api/v1/amt/networkSettings/wireless/profileSync/c59f804d-9c0d-4c13-b09b-d5989efccabb \
    -H "Authorization: Bearer $TOKEN"


  Output:
  {"localProfileSync":true,"uefiProfileSync":false,"uefiProfileSyncSupported":false}
 curl -s -m 30 -w "\nHTTP %{http_code}\n" -X POST \
    http://localhost:8181/api/v1/amt/networkSettings/wireless/profileSync/c59f804d-9c0d-4c13-b09b-d5989efccabb \
    -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
    -d '{"uefiProfileSync":true}'

  Output:
  {"error":"Set Wireless Profile Sync failed for guid: c59f804d-9c0d-4c13-b09b-d5989efccabb. - UEFI WiFi profile sync is not supported on this device"}
  HTTP 409
  1. AMT 15:
 curl -s -m 30 -w "\nHTTP %{http_code}\n" \
    http://localhost:8181/api/v1/amt/networkSettings/wireless/profileSync/4c4c4544-0035-5a10-8046-b4c04f564433 \
    -H "Authorization: Bearer $TOKEN"
  Output:
  {"localProfileSync":false,"uefiProfileSync":false,"uefiProfileSyncSupported":false}
  HTTP 200
 curl -s -m 30 -w "\nHTTP %{http_code}\n" -X POST \
    http://localhost:8181/api/v1/amt/networkSettings/wireless/profileSync/4c4c4544-0035-5a10-8046-b4c04f564433 \
    -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
    -d '{"uefiProfileSync":true}'
  Output:
  {"error":"Set Wireless Profile Sync failed for guid: 4c4c4544-0035-5a10-8046-b4c04f564433. - UEFI WiFi profile sync is not supported on this device"}
  HTTP 409
curl -s -m 30 -w "\nHTTP %{http_code}\n" -X POST \
   http://localhost:8181/api/v1/amt/networkSettings/wireless/profileSync/4c4c4544-0035-5a10-8046-b4c04f564433 \
   -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
   -d '{"localProfileSync":false}'
 Output:
 {"localProfileSync":false,"uefiProfileSync":false,"uefiProfileSyncSupported":false}
 HTTP 200

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.

Configure WiFi synchronization settings from Console

3 participants