# olef lab

Source: https://olef.dev/docs/reference/cli/lab

Generated from **Olef 3.0.2**. [All commands](https://olef.dev/docs/reference/commands) · [Capabilities and requirements](https://olef.dev/docs/reference/capabilities)

These entries describe available commands, not a sequence to run. Check prerequisites before changing app, device, or cloud state. Global options are listed in the [command catalog](https://olef.dev/docs/reference/commands#global-options).

## olef lab

This machine as a device lab for Olef Cloud: `lab register`, `lab add <serial|ip:port>`, `lab serve`; leased as `lab:<lab>/<device>`

```bash
olef lab --help
```

Output: **json**.

### olef lab register

Register this machine as a lab with your Olef Cloud account (needs `cloud login`); keeps the lab credential under `~/.olef/lab/`

```bash
olef lab register --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--name <NAME>` | **Required.** The lab's name (letters, digits, '-', '_') |
| `--reset <RESET>` | What a reset undoes after each lease: `full` (back to the enrolment baseline), `lease_only` (only what the lease installed, created or changed; for devices people also use) or `none` Default: `full`. Values: `full`, `lease_only`, `none`. |
| `--adb-port <ADB_PORT>` | The lab's adb server port Default: `5047`. |
| `--force` | Replace an existing lab registration on this machine |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef lab devices

Devices the lab's own adb server sees, enrolled or not

```bash
olef lab devices --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef lab pair

Pair an Android 11+ device for wireless debugging with the lab's adb key (the code and port from Settings › Wireless debugging › Pair)

```bash
olef lab pair --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<address>` | **Required.** `host:port` from the pairing dialog |
| `<code>` | **Required.** The six-digit pairing code |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef lab add

Enrol a device: probe it, record its baseline, offer it in the Cloud. For a network device give `host:port` (Fire TV: `<ip>:5555`); the device asks once to trust the lab's adb key

```bash
olef lab add --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<lab_device>` | **Required.** The device's serial on the lab's adb server, or `host:port` for a network device |
| `--name <NAME>` | **Required.** Its name in the lab (`lab:<lab>/<name>`) |
| `--timeout-ms <TIMEOUT_MS>` | How long to wait for the device to trust the lab key Default: `120000`. |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef lab serve

Run the lab agent: tunnel to the Cloud, serve leases, reset devices

```bash
olef lab serve --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--for-ms <FOR_MS>` | Exit after this long (tests) |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef lab status

The lab, its devices and their states

```bash
olef lab status --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef lab remove

Stop offering a device and forget it

```bash
olef lab remove --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<lab_device>` | **Required.** Device name or id |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef lab reset

Ask the Cloud to reset a device now (it must be free)

```bash
olef lab reset --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<lab_device>` | **Required.** Device name or id |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef lab baseline

A device's enrolment baseline, or what differs from it now

```bash
olef lab baseline --help
```

Output: **json**.

#### olef lab baseline show

What was recorded at enrolment

```bash
olef lab baseline show --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<lab_device>` | **Required.** Device name or id |
| `--json` | Accepted for compatibility; output is always JSON. |

#### olef lab baseline diff

What differs from it now

```bash
olef lab baseline diff --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<lab_device>` | **Required.** Device name or id |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef lab service

Run the agent as a system service (macOS LaunchDaemon, Linux systemd)

```bash
olef lab service --help
```

Output: **json**.

#### olef lab service install

Write the service definition and print the one command (`sudo`) that installs it

```bash
olef lab service install --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--json` | Accepted for compatibility; output is always JSON. |

#### olef lab service uninstall

Print the command that removes it

```bash
olef lab service uninstall --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--json` | Accepted for compatibility; output is always JSON. |

#### olef lab service start

Let the installed service run the agent (no `sudo`)

```bash
olef lab service start --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--json` | Accepted for compatibility; output is always JSON. |

#### olef lab service stop

Stop the agent and keep the service from restarting it (no `sudo`); its devices go offline in the Cloud

```bash
olef lab service stop --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--json` | Accepted for compatibility; output is always JSON. |
