schemas: TemplateId: type: string minLength: 1 maxLength: 48 pattern: "^[a-z0-9][a-z0-9-]{0,47}$" description: >- Identifier of a lab template known to the provisioner, such as `mikrotik-ospf-pair`. Templates are part of the provisioner build; the request never carries node images, commands, or configuration. NodeName: type: string minLength: 1 maxLength: 15 pattern: "^[a-z][a-z0-9-]{0,14}$" description: >- Name of a node inside its template, such as `r1` or `srv`. It is the same in every lab of the template and is not an LXD instance name or a host name. NodeKind: type: string description: |- Guest system of a node. - mikrotik: a MikroTik Cloud Hosted Router VM; its console is RouterOS. - ubuntu: a small Ubuntu VM; its console is a Linux login. Adding a value is a contract change. enum: - mikrotik - ubuntu LabCreateRequest: type: object description: >- A lab of one template variant. It has no field for a candidate, account, attempt, task, or company. additionalProperties: false required: - template_id - template_version - seed - ttl_seconds properties: template_id: $ref: "#/schemas/TemplateId" template_version: type: integer format: int32 minimum: 1 maximum: 10000 description: >- Version of the template. The provisioner refuses a version it does not hold, so a lab always matches the variant the backend served. seed: type: string minLength: 64 maxLength: 64 pattern: "^[0-9a-f]{64}$" description: >- Variant seed: 32 random bytes in lowercase hex chosen by the backend for the item instance. The template renders the variant configuration of every node and the checker criteria from it. It is never returned by the provisioner. ttl_seconds: type: integer format: int32 minimum: 300 maximum: 14400 description: >- Lifetime of the lab from its creation. The provisioner refuses a value above its configured maximum. LabState: type: string description: |- State of a lab. - provisioning: capacity is reserved and the nodes are being cloned, connected, and booted. - ready: every node answers on its management port; console tokens and checks are allowed. - deleting: the timer ended, DeleteLab was called, or provisioning failed; the instances and bridges are being removed. - deleted: every instance and bridge of the lab is gone and its capacity is free. - failed: provisioning failed or timed out, or the provisioner restarted while provisioning; `failure_reason` says which. Its resources are removed as for `deleting` and the capacity returns once they are gone; create a new lab with a new ID. Adding a value is a contract change. enum: - provisioning - ready - deleting - deleted - failed LabFailureReason: type: string description: |- Why a lab failed. None of the reasons depends on the person who uses the lab. - provisioning_failed: LXD refused or failed an operation of the provisioning. - provisioning_timed_out: a node did not answer on its management port within the provisioning timeout. - interrupted: the provisioner process stopped while the lab was provisioning. enum: - provisioning_failed - provisioning_timed_out - interrupted LabNode: type: object description: >- A node of a lab by its template name and kind. It never carries an address, a MAC address, an instance name, or a credential. additionalProperties: false required: - name - kind properties: name: $ref: "#/schemas/NodeName" kind: $ref: "#/schemas/NodeKind" LabStatus: type: object description: >- State of a lab after one call. It never contains the seed, a node address, a key, a password, or an LXD object name. additionalProperties: false required: - lab_id - state - template_id - template_version - created_at - expires_at - nodes properties: lab_id: type: string format: uuid state: $ref: "#/schemas/LabState" template_id: $ref: "#/schemas/TemplateId" template_version: type: integer format: int32 minimum: 1 maximum: 10000 created_at: type: string format: date-time ready_at: type: string format: date-time description: Time the lab became `ready`; absent before. expires_at: type: string format: date-time description: >- Time the provisioner deletes the lab. It never moves, also not across restarts of the provisioner. deleted_at: type: string format: date-time description: Time the last resource of the lab was removed; absent before. failure_reason: $ref: "#/schemas/LabFailureReason" nodes: type: array minItems: 1 maxItems: 8 description: Nodes of the template in template order. items: $ref: "#/schemas/LabNode" ConsoleTokenRequest: type: object additionalProperties: false required: - node properties: node: $ref: "#/schemas/NodeName" ConsoleToken: type: object description: >- Single-use console token for one node. The token is a secret of the console gateway: it is never logged, stored by the backend, or passed to a browser. additionalProperties: false required: - token - node - expires_at - attach_path properties: token: type: string minLength: 43 maxLength: 43 pattern: "^[A-Za-z0-9_-]{43}$" description: 32 random bytes in unpadded base64url. node: $ref: "#/schemas/NodeName" expires_at: type: string format: date-time attach_path: type: string maxLength: 128 pattern: "^/v1/labs/[0-9a-f-]{36}/console$" description: Path of the WebSocket attach on the provisioner origin. CriterionId: type: string minLength: 1 maxLength: 32 pattern: "^[a-z0-9][a-z0-9_-]{0,31}$" description: Opaque identifier of a checker criterion of the template. CriterionResult: type: object additionalProperties: false required: - id - passed properties: id: $ref: "#/schemas/CriterionId" passed: type: boolean LabCheckResult: type: object description: >- Result of one check: whether each criterion of the variant holds on the nodes. It carries no node output, address, or configuration text. additionalProperties: false required: - lab_id - checked_at - score - max_score - criteria properties: lab_id: type: string format: uuid checked_at: type: string format: date-time score: type: integer format: int32 minimum: 0 maximum: 50 description: Number of passed criteria. max_score: type: integer format: int32 minimum: 1 maximum: 50 description: Number of criteria. criteria: type: array minItems: 1 maxItems: 50 items: $ref: "#/schemas/CriterionResult"