237 lines
8.0 KiB
YAML
237 lines
8.0 KiB
YAML
schemas:
|
|
AssessmentLabNodeName:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 15
|
|
pattern: "^[a-z][a-z0-9-]{0,14}$"
|
|
description: >-
|
|
Name of a lab node as the task statement uses it, such as `r1` or
|
|
`srv`. It is a label of the task, not a host name or an address.
|
|
AssessmentLabNodeKind:
|
|
type: string
|
|
description: |-
|
|
What the console of a node shows.
|
|
|
|
- mikrotik: a MikroTik router with the RouterOS console.
|
|
- ubuntu: a small Ubuntu server with a Linux login.
|
|
|
|
Adding a value is a contract change.
|
|
enum:
|
|
- mikrotik
|
|
- ubuntu
|
|
AssessmentLabNode:
|
|
type: object
|
|
description: >-
|
|
A node of a lab by its task name and kind. It never carries an address,
|
|
a MAC address, a port, a password, a key, or an infrastructure name.
|
|
additionalProperties: false
|
|
required:
|
|
- name
|
|
- kind
|
|
properties:
|
|
name:
|
|
$ref: "#/schemas/AssessmentLabNodeName"
|
|
kind:
|
|
$ref: "#/schemas/AssessmentLabNodeKind"
|
|
LabItemContent:
|
|
type: object
|
|
description: >-
|
|
Practical lab: configure or repair a small network of virtual nodes
|
|
through their consoles. The candidate starts the lab of the item with
|
|
CreateMyAssessmentLab, works in the node consoles, and submits with
|
|
SubmitMyAssessmentLab; the server then checks the state of the nodes.
|
|
The content lists only the nodes the statement names and the lifetime
|
|
of the lab, never the checker, its criteria, the seed, or an address.
|
|
SubmitMyAssessmentAnswer takes no answer to a lab item; its result is
|
|
submitted only with SubmitMyAssessmentLab.
|
|
additionalProperties: false
|
|
required:
|
|
- format
|
|
- nodes
|
|
- time_limit_seconds
|
|
properties:
|
|
format:
|
|
type: string
|
|
enum:
|
|
- lab
|
|
nodes:
|
|
type: array
|
|
minItems: 1
|
|
maxItems: 8
|
|
description: Nodes of the lab in the order of the statement.
|
|
items:
|
|
$ref: "#/schemas/AssessmentLabNode"
|
|
time_limit_seconds:
|
|
type: integer
|
|
format: int32
|
|
minimum: 300
|
|
maximum: 14400
|
|
description: >-
|
|
Lifetime of a lab of this item from its creation. The lab also ends
|
|
no later than the attempt deadline.
|
|
LabAnswer:
|
|
type: object
|
|
description: >-
|
|
Answer of a lab item: the state of the nodes of the named lab at the
|
|
moment of submission. The server reads that state with the checker of
|
|
the task; the body carries no configuration text, score, or
|
|
correctness flag. Two answers are equal when they name the same lab.
|
|
It is the answer of SubmitMyAssessmentLab only and is not a member of
|
|
AssessmentAnswer.
|
|
additionalProperties: false
|
|
required:
|
|
- format
|
|
- lab_id
|
|
properties:
|
|
format:
|
|
type: string
|
|
enum:
|
|
- lab
|
|
lab_id:
|
|
type: string
|
|
format: uuid
|
|
description: The lab of this item that the candidate worked in.
|
|
AssessmentLabState:
|
|
type: string
|
|
description: |-
|
|
State of a lab of an attempt item.
|
|
|
|
- provisioning: the nodes are being prepared; poll GetMyAssessmentLab.
|
|
- ready: the consoles can be opened until `expires_at`.
|
|
- checking: the answer was accepted; the consoles are closed and the server checks the nodes.
|
|
- submitted: the check finished and the answer is recorded; the lab is deleted. The state never says whether the answer was correct.
|
|
- expired: the lifetime or the attempt deadline ended before a submission; the lab is deleted and the item cannot start another lab.
|
|
- failed: the lab infrastructure failed, independently of the candidate; `failure_reason` is `lab_error`. Nothing was recorded or consumed, and the candidate may start a new lab of the same item while the item is current.
|
|
|
|
Adding a value is a contract change.
|
|
enum:
|
|
- provisioning
|
|
- ready
|
|
- checking
|
|
- submitted
|
|
- expired
|
|
- failed
|
|
AssessmentLabFailureReason:
|
|
type: string
|
|
description: >-
|
|
Why a lab failed: `lab_error` for an infrastructure failure, such as a
|
|
node that did not boot or a check that could not reach a node. It never
|
|
depends on the candidate and is never a failed check.
|
|
enum:
|
|
- lab_error
|
|
AssessmentLab:
|
|
type: object
|
|
description: >-
|
|
Candidate view of the lab of one attempt item. It contains no node
|
|
address, MAC address, port, password, key, token, seed, checker state,
|
|
criteria, score, or infrastructure name.
|
|
additionalProperties: false
|
|
required:
|
|
- id
|
|
- item_id
|
|
- state
|
|
- nodes
|
|
- created_at
|
|
- ready_at
|
|
- expires_at
|
|
- finished_at
|
|
- failure_reason
|
|
properties:
|
|
id:
|
|
type: string
|
|
format: uuid
|
|
description: Identifier of the lab.
|
|
item_id:
|
|
$ref: "./assessment_schemas.yml#/schemas/AssessmentItemId"
|
|
state:
|
|
$ref: "#/schemas/AssessmentLabState"
|
|
nodes:
|
|
type: array
|
|
minItems: 1
|
|
maxItems: 8
|
|
items:
|
|
$ref: "#/schemas/AssessmentLabNode"
|
|
created_at:
|
|
$ref: "./common_schemas.yml#/schemas/Timestamp"
|
|
ready_at:
|
|
description: Time the lab became `ready`, or null before.
|
|
oneOf:
|
|
- $ref: "./common_schemas.yml#/schemas/Timestamp"
|
|
- type: "null"
|
|
expires_at:
|
|
description: >-
|
|
Time the lab ends unless it was submitted before: the earlier of the
|
|
lifetime of the item and the attempt deadline. It never moves.
|
|
$ref: "./common_schemas.yml#/schemas/Timestamp"
|
|
finished_at:
|
|
description: Time the lab reached `submitted`, `expired`, or `failed`, or null.
|
|
oneOf:
|
|
- $ref: "./common_schemas.yml#/schemas/Timestamp"
|
|
- type: "null"
|
|
failure_reason:
|
|
description: "`lab_error` when `state` is `failed`, otherwise null."
|
|
oneOf:
|
|
- $ref: "#/schemas/AssessmentLabFailureReason"
|
|
- type: "null"
|
|
AssessmentLabCreate:
|
|
type: object
|
|
description: Start the lab of the current lab item. Unknown fields are rejected.
|
|
additionalProperties: false
|
|
required:
|
|
- item_id
|
|
properties:
|
|
item_id:
|
|
$ref: "./assessment_schemas.yml#/schemas/AssessmentItemId"
|
|
AssessmentLabConsoleSessionCreate:
|
|
type: object
|
|
description: Open a console of one node of a ready lab. Unknown fields are rejected.
|
|
additionalProperties: false
|
|
required:
|
|
- node
|
|
properties:
|
|
node:
|
|
$ref: "#/schemas/AssessmentLabNodeName"
|
|
AssessmentLabConsoleSession:
|
|
type: object
|
|
description: >-
|
|
A console session of one node. The client opens a WebSocket to
|
|
`websocket_path` on the same origin before `expires_at`; the session
|
|
cookie and the Origin check authorize the upgrade, so no secret travels
|
|
in the path, the body, or a query string. A session can be attached
|
|
once and ends with the lab.
|
|
additionalProperties: false
|
|
required:
|
|
- id
|
|
- node
|
|
- websocket_path
|
|
- expires_at
|
|
properties:
|
|
id:
|
|
type: string
|
|
format: uuid
|
|
description: Identifier of the console session; it is not a secret.
|
|
node:
|
|
$ref: "#/schemas/AssessmentLabNodeName"
|
|
websocket_path:
|
|
type: string
|
|
maxLength: 128
|
|
pattern: "^/api/v1/me/assessment-lab-consoles/[0-9a-f-]{36}$"
|
|
description: Same-origin path of the console WebSocket.
|
|
expires_at:
|
|
description: Time by which the WebSocket must be opened.
|
|
$ref: "./common_schemas.yml#/schemas/Timestamp"
|
|
AssessmentLabSubmission:
|
|
type: object
|
|
description: >-
|
|
Submit the lab of the current lab item as its answer. Unknown fields
|
|
are rejected, so a request cannot send a score or a correctness flag.
|
|
additionalProperties: false
|
|
required:
|
|
- expected_version
|
|
- answer
|
|
properties:
|
|
expected_version:
|
|
$ref: "./assessment_schemas.yml#/schemas/AssessmentAttemptVersion"
|
|
answer:
|
|
$ref: "#/schemas/LabAnswer"
|