feat: implement redfish kvm user consent actions#1027
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## redfish #1027 +/- ##
===========================================
+ Coverage 42.03% 42.79% +0.76%
===========================================
Files 152 153 +1
Lines 14581 14793 +212
===========================================
+ Hits 6129 6331 +202
- Misses 7873 7883 +10
Partials 579 579 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4b02653 to
d9161eb
Compare
1. Implement KVM consent request/submit/cancel end-to-end. 2. Implement KVM and user consent status in graphical console. Signed-off-by: C, Amarnath <amarnath.c@intel.com>
There was a problem hiding this comment.
Pull request overview
This PR implements Redfish KVM user consent actions end-to-end and exposes KVM user consent state in the graphical console model.
Changes:
- Adds request, submit, and cancel KVM consent flows through handler, use case, repository interface, WSMAN repository, and mocks.
- Adds typed consent failure errors and success response handling for the new Redfish actions.
- Updates graphical console KVM status/user-consent status logic and expands unit/controller test coverage.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
redfish/internal/usecase/wsman_repo.go |
Adds KVM consent repository methods and graphical console consent-status mapping. |
redfish/internal/usecase/wsman_repo_test.go |
Adds WSMAN repo and status-mapping tests for KVM consent behavior. |
redfish/internal/usecase/interfaces.go |
Extends the computer system repository interface with KVM consent methods. |
redfish/internal/usecase/consent_errors.go |
Adds typed consent operation failure errors. |
redfish/internal/usecase/consent_errors_test.go |
Tests consent failure error message formatting. |
redfish/internal/usecase/computer_system.go |
Adds use-case pass-through methods and exposes KVM consent actions. |
redfish/internal/usecase/computer_system_test.go |
Updates use-case mock coverage and validates exposed action targets. |
redfish/internal/usecase/computer_system_fuzz_test.go |
Updates fuzz mock repository to satisfy the expanded interface. |
redfish/internal/mocks/mock_repo.go |
Updates mock repository with KVM consent methods. |
redfish/internal/controller/http/v1/handler/systems_test.go |
Updates test repository behavior for KVM consent actions. |
redfish/internal/controller/http/v1/handler/systems_actions.go |
Implements the three KVM consent HTTP handlers and shared success/error handling. |
redfish/internal/controller/http/v1/handler/systems_actions_test.go |
Adds controller tests for success and error paths of KVM consent actions. |
redfish/internal/controller/http/v1/handler/routes_test.go |
Updates route test repository to satisfy the expanded interface. |
| case int(optin.NotStarted), int(optin.Requested), int(optin.Displayed): | ||
| return userConsentRequested |
There was a problem hiding this comment.
@amarnath-ac : Please looks into this comment. Its a valid one. I did try out this on a system after the device has been activated and I see the below:
"GraphicalConsole": {
"ConnectTypesSupported": [
"KVMIP"
],
"Oem": {
"Intel": {
"AMT": {
"ControlMode": "CCM",
"KVMStatus": "PendingConsent",
"UserConsentStatus": "Requested"
}
}
},
"Port": 16995,
"ServiceEnabled": true
},
We might to have add "NotStarted" or "Required" here.
There was a problem hiding this comment.
Yes its valid, same i discussed with Devipriya, will do it in new PR which required spec and code changes.
|
Please check the error shown for the following scenario. In ACM the request for sending a user consent seems to be incorrect Message": "RequestKVMConsent failed with ReturnValue=2: cannot request consent in the current opt-in state (request may already be pending) There's not need of mentioning (request may already be pending) |
|
When does the "ComputerSystem_OemIntelAMTUserConsentStatus" Timeout get triggered. |
|
Fuzz tests for the new API's are missing could you please add them |
|
|
||
| return nil | ||
| } | ||
|
|
There was a problem hiding this comment.
You need to update the fuzz tests for these three API's instead of returning not foune
| return nil | ||
| } | ||
|
|
||
| // RequestKVMConsent starts a mock KVM consent flow for an existing system. |
There was a problem hiding this comment.
Please update the mock repo for the GraphicConsole related changes so that these API's can be demonstrated successfully when we run console with "REDFISH_USE_MOCK=true"
| assertErrorResponse(t, w) | ||
| } | ||
|
|
||
| func TestPostRedfishV1SystemsComputerSystemIdActionsOemIntelComputerSystemRequestKVMConsent_InternalError(t *testing.T) { |
There was a problem hiding this comment.
Can you add tests for failures in RequestKVMConsent in ACM Mode
| } | ||
|
|
||
| // RequestKVMConsent starts a user consent request on the target system. | ||
| func (r *WsmanComputerSystemRepo) RequestKVMConsent(ctx context.Context, systemID string) error { |
There was a problem hiding this comment.
Where are the checks for the Control Mode done ? Should we not have the checks here ?
Test: