Skip to content

Commit ce55003

Browse files
Add test cases for bootstrapstream (#4177)
* update Readme * update json * update json * Modifying test to include post switchover validation (#5427) * Modifying test to include post switchover validation and increasing the scale * adding ipv6 and telemetry checks * fix last boot to be parse int --------- Co-authored-by: Rohit Rattan <rohitrattan@google.com>
1 parent aa0f505 commit ce55003

1 file changed

Lines changed: 209 additions & 4 deletions

File tree

  • feature/system/secure_boot/tests/bootz

feature/system/secure_boot/tests/bootz/README.md

Lines changed: 209 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ bootserver can initialize the devices configuration into the provided configurat
3333
| ID | Case | Result |
3434
| --------- | ------------- | --- |
3535
| bootz-1.1 | Missing configuration | Device fails with status invalid parameter |
36-
| bootz-1.2 |Invalid configuration | Device fails with status invalid parameter |
37-
| bootz-1.3 |Valid configuration | Device succeded with status ok |
36+
| bootz-1.2 | Invalid configuration | Device fails with status invalid parameter |
37+
| bootz-1.3 | Valid configuration | Device succeded with status ok |
3838

3939
1. Provide bootstrap reponse configured as prescribed.
4040
2. Initiate bootz boot on device via gnoi.FactoryReset()
@@ -171,9 +171,198 @@ by the bootz process. If the artifacts are incomplete an error will be returned.
171171
| bootz-5.3 | gNSI ca auth policy provided | Device fails with status invalid parameter |
172172
| bootz-5.4 | gNSI Authz policy | Device fails with invalid parameter |
173173

174+
1. Provide bootstrap response configured as prescribed.
175+
2. Initiate bootz boot on device via gnoi.FactoryReset()
176+
3. Validate device sends bootz request to bootserver
177+
4. Validate the progress periodically by subscribing to `/system/bootz/state/status`
178+
* The status should transition from:
179+
* BOOTZ_UNSPECIFIED
180+
* BOOTZ_SENT
181+
* BOOTZ_RECEIVED
182+
* BOOTZ_CONFIGURATION_APPLIED
183+
* BOOTZ_OK
184+
* For error case device should report
185+
* BOOTZ_UNSPECIFIED
186+
* BOOTZ_SENT
187+
* BOOTZ_RECEIVED
188+
* BOOTZ_OS_INVALID_IMAGE
189+
5. Validate device telemetry
190+
* `/system/bootz/state/last-boot-attempt` is in expected state
191+
* `/system/bootz/state/error-count` is in incremented if failure case
192+
* `/system/bootz/state/status` is in expected state
193+
* `/system/bootz/state/checksum` matches sent proto
194+
6. Validate device state
195+
* System configuration is as expected.
196+
197+
### bootz-6: Validate bootz.Bootstrap.BootstrapStream
198+
199+
The purpose of this test is to validate BootstrapStream rpc. This
200+
RPC allows for only requiring a self-signed cert for TLS session.
201+
The rest of the stream will create trust for both client and server via
202+
the internal protocol documented at [BootstrapStream](https://github.com/openconfig/bootz/blob/main/proto/bootz.proto#L47).
203+
204+
```mermaid
205+
sequenceDiagram
206+
actor Device
207+
actor Server
208+
Device->Server: BootstrapStreamRequest.bootstrap_request
209+
Note right of Server: Server will query OVGS to validate<br>the device and fetch needed keys<br>and build challenge
210+
Server->Device: BootstrapStreamResponse.challenge
211+
Note left of Device: Device will use private keys<br>to build the challenge reponse
212+
Device->Server: BootstrapStreamRequest.response
213+
Note right of Server: Server will validate the response and if valid<br>return bootstrap data
214+
Server->Device: BootstrapStreamResponse.bootstrap_data
215+
```
216+
217+
#### bootz-6.1: Validate minimum necessary bootz configuration
218+
219+
This test validates that the device can start in bootz mode and upon getting a bootz response from
220+
bootserver can initialize the devices configuration into the provided configuration.
221+
222+
| ID | Case | Result |
223+
| --------- | ------------- | --- |
224+
| bootz-6.1.1 | Missing configuration | Device fails with status invalid parameter |
225+
| bootz-6.1.2 | Invalid configuration | Device fails with status invalid parameter |
226+
| bootz-6.1.3 | Valid configuration | Device succeded with status ok |
227+
174228
1. Provide bootstrap reponse configured as prescribed.
175229
2. Initiate bootz boot on device via gnoi.FactoryReset()
176230
3. Validate device sends bootz request to bootserver
231+
4. Validate device telemetry
232+
233+
* `/system/bootz/state/last-boot-attempt` is in expected state
234+
* `/system/bootz/state/error-count` is in incremented if failure case
235+
* `/system/bootz/state/status` is in expected state
236+
* `/system/bootz/state/checksum` matches sent proto
237+
238+
5. Validate device state
239+
240+
* OS version is the same
241+
* System configuration is as expected.
242+
243+
#### bootz-6.2: Validate Software image in bootz configuration
244+
245+
This test validates the bootz behavior based changes to software version.
246+
247+
| ID | Case | Result |
248+
| --------- | ------------- | --- |
249+
| bootz-6.2.1 | Software version is different | Device is upgraded to the new version |
250+
| bootz-6.2.2 | Invalid software image | Device fails with status invalid parameter |
251+
252+
1. Validate the device is on a different version from the expected new version.
253+
2. Provide bootstrap reponse configured as prescribed.
254+
3. Initiate bootz boot on device via gnoi.FactoryReset()
255+
4. Validate device sends bootz request to bootserver
256+
5. Validate the progress periodically by polling `/system/bootz/state/status`
257+
* The status should transition from:
258+
* BOOTZ_UNSPECIFIED
259+
* BOOTZ_SENT
260+
* BOOTZ_RECEIVED
261+
* BOOTZ_OS_UPGRADE_IN_PROGRESS
262+
* BOOTZ_OS_UPGRADE_COMPLETE
263+
* BOOTZ_CONFIGURATION_APPLIED
264+
* BOOTZ_OK
265+
* For error case device should report
266+
* BOOTZ_UNSPECIFIED
267+
* BOOTZ_SENT
268+
* BOOTZ_RECEIVED
269+
* BOOTZ_OS_UPGRADE_IN_PROGRESS
270+
* BOOTZ_OS_INVALID_IMAGE
271+
6. Validate device telemetry
272+
* `/system/bootz/state/last-boot-attempt` is in expected state
273+
* `/system/bootz/state/error-count` is in incremented if failure case
274+
* `/system/bootz/state/status` is in expected state
275+
* `/system/bootz/state/checksum` matches sent proto
276+
7. Validate device state
277+
* OS version is the same
278+
* System configuration is as expected.
279+
280+
### bootz-6.3: Validate Ownership Voucher in bootz configuration
281+
282+
The purpose of this test is to validate that the ownership voucher can
283+
be sent to the device and properly handled.
284+
285+
| ID |Case | Result |
286+
| --------- | ------------- | --- |
287+
| bootz-6.3.1 | No ownership voucher | Device boots without OV present |
288+
| bootz-6.3.2 | Invalid OV | Device fails with status invalid parameter |
289+
| bootz-6.3.3 | OV fails | Device fails with status invalid parameter |
290+
| bootz-6.3.4 | OV valid | Device boots with OV installed |
291+
292+
1. Provide bootstrap reponse configured as prescribed.
293+
2. Initiate bootz boot on device via gnoi.FactoryReset()
294+
3. Validate device sends bootz request to bootserver
295+
4. Validate the progress periodically by polling `/system/bootz/state/status`
296+
* The status should transition from:
297+
* BOOTZ_UNSPECIFIED
298+
* BOOTZ_SENT
299+
* BOOTZ_RECEIVED
300+
* BOOTZ_CONFIGURATION_APPLIED
301+
* BOOTZ_OK
302+
* For error case device should report
303+
* BOOTZ_UNSPECIFIED
304+
* BOOTZ_SENT
305+
* BOOTZ_RECEIVED
306+
* BOOTZ_OV_INVALID
307+
5. Validate device telemetry
308+
* `/system/bootz/state/last-boot-attempt` is in expected state
309+
* `/system/bootz/state/error-count` is in incremented if failure case
310+
* `/system/bootz/state/status` is in expected state
311+
* `/system/bootz/state/checksum` matches sent proto
312+
6. Validate device state
313+
* System configuration is as expected.
314+
315+
### bootz-6.4: Validate device properly resets if provided invalid image
316+
317+
The purpose of this test is to validate that when providing an invalid or
318+
non bootable image the device properly handles this and resets itself into
319+
bootz mode.
320+
321+
| ID |Case | Result |
322+
| --------- | ------------- | --- |
323+
| bootz-6.4.1 | no OS provided | Device boots with existing image |
324+
| bootz-6.4.2 | Invalid OS image provided | Device fails with status invalid parameter |
325+
| bootz-6.4.3 | failed to fetch image from remote URL | Device fails with status invalid parameter |
326+
| bootz-6.4.4 | OS checksum doesn't match | Device fails with invalid parameter |
327+
328+
1. Provide bootstrap reponse configured as prescribed.
329+
2. Initiate bootz boot on device via gnoi.FactoryReset()
330+
3. Validate device sends bootz request to bootserver
331+
4. Validate the progress periodically by polling `/system/bootz/state/status`
332+
* The status should transition from:
333+
* BOOTZ_UNSPECIFIED
334+
* BOOTZ_SENT
335+
* BOOTZ_RECEIVED
336+
* BOOTZ_CONFIGURATION_APPLIED
337+
* BOOTZ_OK
338+
* For error case device should report
339+
* BOOTZ_UNSPECIFIED
340+
* BOOTZ_SENT
341+
* BOOTZ_RECEIVED
342+
* BOOTZ_OS_INVALID_IMAGE
343+
5. Validate device telemetry
344+
* `/system/bootz/state/last-boot-attempt` is in expected state
345+
* `/system/bootz/state/error-count` is in incremented if failure case
346+
* `/system/bootz/state/status` is in expected state
347+
* `/system/bootz/state/checksum` matches sent proto
348+
6. Validate device state
349+
* System configuration is as expected.
350+
351+
### bootz-6.5: Validate gNSI components in bootz configuration
352+
353+
The purpose of this test is to validate that gNSI artifacts are properly loaded
354+
by the bootz process. If the artifacts are incomplete an error will be returned.
355+
356+
| ID |Case | Result |
357+
| --------- | ------------- | --- |
358+
| bootz-6.5.1 | no gNSI artifacts are provided | Device boots with services default security policies |
359+
| bootz-6.5.2 | gNSI certz policy is sent CA trust bundle | Device creates new policy with CA bundle set |
360+
| bootz-6.5.3 | gNSI ca auth policy provided | Device fails with status invalid parameter |
361+
| bootz-6.5.4 | gNSI Authz policy | Device fails with invalid parameter |
362+
363+
1. Provide bootstrap response configured as prescribed.
364+
2. Initiate bootz boot on device via gnoi.FactoryReset()
365+
3. Validate device sends bootz request to bootserver
177366
4. Validate the progress periodically by subscribing to `/system/bootz/state/status`
178367
* The status should transition from:
179368
* BOOTZ_UNSPECIFIED
@@ -196,7 +385,6 @@ by the bootz process. If the artifacts are incomplete an error will be returned.
196385

197386
## OpenConfig Path and RPC Coverage
198387

199-
200388
```yaml
201389
paths:
202390
/system/bootz/state/last-boot-attempt:
@@ -209,8 +397,25 @@ rpcs:
209397
on_change: true
210398
gnoi:
211399
bootconfig.BootConfig.GetBootConfig:
212-
bootconfig.BootConfig.SetBootConfig:
213400
bootz:
214401
Bootstrap.GetBootstrapData:
215402
Bootstrap.ReportStatus:
403+
Bootstrap.BootstrapStream:
216404
```
405+
406+
## Canonical OC
407+
408+
```json
409+
{
410+
"system": {
411+
"bootz": {
412+
"state": {
413+
"last-boot-attempt": "0",
414+
"error-count": "0",
415+
"status": "BOOTZ_OK",
416+
"checksum": ""
417+
}
418+
}
419+
}
420+
}
421+
```

0 commit comments

Comments
 (0)