-
Notifications
You must be signed in to change notification settings - Fork 29
feat: Remote Platform Erase capability #2407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nmgaston
wants to merge
19
commits into
main
Choose a base branch
from
remotePlatformErase
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b99abac
feat: remote platform erase capability
nmgaston ed43900
Merge branch 'main' into remotePlatformErase
nmgaston 47eb289
feat: changes to match sample-web-ui
nmgaston 99b2d24
fix: tests and lint errors
nmgaston 36f4fcf
fix: issues found during testing
nmgaston 488c45a
feat: add power state to sendRPE API for ability to turn on, when RPE…
nmgaston fb5c408
fix: issue with state tracking of RPE state in UI tabs
nmgaston 00f304b
Merge branch 'main' into remotePlatformErase
nmgaston 54d6c5a
fix: merge conflicts
nmgaston bbc3caa
fix: add backwards compatibility for getPowerCapabilities
nmgaston b9ac40d
fix: formatting
nmgaston 1cea071
Merge branch 'main' into remotePlatformErase
nmgaston f6b0f86
Merge branch 'main' into remotePlatformErase
nmgaston 57aa21c
fix: allow CMSE clear with hardware clear
nmgaston 0b2b790
feat: add SSD Password to RPE
nmgaston eff353a
fix: AI comment
nmgaston 0c4a10e
feat: add SSD Password to RPE
nmgaston 2e000b7
fix: add device lock and remove RPE from powerActions
nmgaston a51d086
fix: merge conflict
nmgaston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /********************************************************************* | ||
| * Copyright (c) Intel Corporation 2022 | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| **********************************************************************/ | ||
|
|
||
| import { ErrorResponse } from '../../utils/amtHelper.js' | ||
| import { MqttProvider } from '../../utils/MqttProvider.js' | ||
| import { getBootCapabilities } from './getBootCapabilities.js' | ||
| import { createSpyObj } from '../../test/helper/vitest.js' | ||
| import { DeviceAction } from '../../amt/DeviceAction.js' | ||
| import { CIRAHandler } from '../../amt/CIRAHandler.js' | ||
| import { HttpHandler } from '../../amt/HttpHandler.js' | ||
| import { messages } from '../../logging/index.js' | ||
| import { vi, type MockInstance } from 'vitest' | ||
|
|
||
| describe('Get Boot Capabilities', () => { | ||
| let req: any | ||
| let resSpy: any | ||
| let mqttSpy: MockInstance | ||
| let bootCapsSpy: MockInstance | ||
| let device: DeviceAction | ||
|
|
||
| beforeEach(() => { | ||
| const handler = new CIRAHandler(new HttpHandler(), 'admin', 'P@ssw0rd') | ||
| device = new DeviceAction(handler, null) | ||
| req = { | ||
| params: { guid: '4c4c4544-004b-4210-8033-b6c04f504633' }, | ||
| deviceAction: device | ||
| } | ||
| resSpy = createSpyObj('Response', [ | ||
| 'status', | ||
| 'json', | ||
| 'end', | ||
| 'send' | ||
| ]) | ||
| resSpy.status.mockReturnThis() | ||
| resSpy.json.mockReturnThis() | ||
| resSpy.send.mockReturnThis() | ||
|
|
||
| mqttSpy = vi.spyOn(MqttProvider, 'publishEvent') | ||
| bootCapsSpy = vi.spyOn(device, 'getBootCapabilities') | ||
| }) | ||
|
|
||
| it('should return boot capabilities', async () => { | ||
| const bootCaps = { | ||
| IDER: true, | ||
| SOL: true, | ||
| BIOSSetup: true, | ||
| PlatformErase: 0x10044 | ||
| } | ||
| bootCapsSpy.mockResolvedValue({ | ||
| Body: { AMT_BootCapabilities: bootCaps } | ||
| }) | ||
|
|
||
| await getBootCapabilities(req, resSpy) | ||
| expect(resSpy.status).toHaveBeenCalledWith(200) | ||
| expect(resSpy.json).toHaveBeenCalledWith({ | ||
| secureEraseAllSSDs: true, | ||
| tpmClear: true, | ||
| restoreBIOSToEOM: false, | ||
| unconfigureCSME: true | ||
| }) | ||
| expect(resSpy.end).toHaveBeenCalled() | ||
| expect(mqttSpy).toHaveBeenCalledTimes(2) | ||
| }) | ||
|
|
||
| it('should return 500 on error', async () => { | ||
| bootCapsSpy.mockRejectedValue(new Error('AMT error')) | ||
|
|
||
| await getBootCapabilities(req, resSpy) | ||
| expect(resSpy.status).toHaveBeenCalledWith(500) | ||
| expect(resSpy.json).toHaveBeenCalledWith(ErrorResponse(500, messages.POWER_CAPABILITIES_EXCEPTION)) | ||
| expect(resSpy.end).toHaveBeenCalled() | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.