Add OpenStack request-body schemas and nested console PARAM sync.

This commit is contained in:
2026-07-18 08:47:38 +03:00
parent cbd0adca91
commit ae297258b1
46 changed files with 42717 additions and 40135 deletions
+3
View File
@@ -66,6 +66,9 @@ curl -skf https://127.0.0.1/health/ready
curl -sf http://127.0.0.1:5000/health/live
```
Open the console at [http://127.0.0.1:5000/](http://127.0.0.1:5000/) — see
[Web UI](web-ui.md) for screenshots of Try-it, catalog, and data drawers.
`/health/ready` returns HTTP 503 until PostgreSQL is reachable **and** the
latest packaged migration is applied.
Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

+1 -1
View File
@@ -46,7 +46,7 @@ make seed-demo
OVIRT_SERIES=4.4 make restart
```
**Hot-swap** (in-memory, no rebuild) — Web UI Environment → Apply pack, or:
**Hot-swap** (in-memory, no rebuild) — Web UI **API catalog****Apply as runtime**, or:
```bash
curl -s http://127.0.0.1:5000/ui/api/ovirt/contracts/activate \
+3
View File
@@ -66,6 +66,9 @@ curl -skf https://127.0.0.1/health/ready
curl -sf http://127.0.0.1:5000/health/live
```
Консоль: [http://127.0.0.1:5000/](http://127.0.0.1:5000/) — скриншоты Try-it,
каталога и ящиков Data см. в [Web UI](web-ui.md).
`/health/ready` возвращает HTTP 503, пока PostgreSQL недоступен **или** не
применена последняя упакованная миграция.
+1 -1
View File
@@ -46,7 +46,7 @@ make seed-demo
OVIRT_SERIES=4.4 make restart
```
**Hot-swap** (in-memory, без пересборки) — Web UI Environment → Apply pack, или:
**Hot-swap** (in-memory, без пересборки) — Web UI **API catalog****Apply as runtime**, или:
```bash
curl -s http://127.0.0.1:5000/ui/api/ovirt/contracts/activate \
+20 -20
View File
@@ -4,38 +4,38 @@
| Профиль | Как загрузить | Содержимое |
|---|---|---|
| `minimal` | Startup симулятора (если БД ещё не `demo`) / `make seed` / `python -m app.ovirt.seed_cli --profile minimal` / Helm seed Job | 1 datacenter, 1 cluster, 1 host, Blank template, 4 пользователя, небольшой sample инвентаря |
| `demo` | `make seed-demo` / ящик Data в UI / Helm `seed.profile=demo` / `--profile demo` | ~1000 ВМ, multi-host DC, сети, storage domains, диски, nested samples |
| `minimal` | Старт (если БД не sized-demo) / `make seed` / `--profile minimal` | 1 DC, 1 cluster, 1 host, Blank, 4 пользователя |
| `small` | `make seed-small` / DATA → **Load small** / `--profile small` | **3 host · 50 ВМ** · 1 DC · 1 cluster · 2 сети · 2 SD |
| `large` | `make seed-large` / DATA → **Load large** / `--profile large` | **10 host · 1000 ВМ** · 2 DC · 2 cluster · пропорциональный инвентарь |
| `big` | `make seed-big` / DATA → **Load big** / `--profile big` | **30 host · 2000 ВМ** · 3 DC · 6 cluster · больше tags/events/jobs |
| `demo` | `make seed-demo` (alias) / `--profile demo` | То же, что **`large`** (старое имя) |
В Compose lifespan FastAPI загружает **`minimal`**, если БД пуста или не
помечена как `demo`. Для большого профиля — `make seed-demo` (или ящик Data в
UI). Helm дополнительно может запускать seed Job (`seed.enabled`).
Sized-demo масштабируют DC, clusters, hosts, VMs, сети, storage domains,
templates, tags, events, jobs и nested samples вместе. Lifespan сохраняет
`small` / `large` / `big` / `demo` при рестарте.
Пароль для всех пользователей: **`secret`**. Домен: **`internal`**.
Principals: `admin@internal`, `ops@internal`, `developer@internal`,
`demo@internal`.
Пароль всех пользователей: **`secret`**. Домен: **`internal`**.
## CLI
```bash
make seed
make seed-demo
# эквивалент
docker compose run --rm --entrypoint python simulator \
-m app.ovirt.seed_cli --profile demo
make seed-small
make seed-large # или: make seed-demo
make seed-big
```
## UI
Ящик **DATA****Load small** / **Load large** / **Load big**, либо
**Reset to minimal**.
API: `POST /ui/api/demo/load?size=small|large|big`
## Helm
```yaml
seed:
enabled: true
profile: demo # или minimal
profile: large # minimal | small | large | big | demo
```
## Поведение
Оба профиля **очищают** (truncate) лабораторные таблицы oVirt и загружают данные
заново. `demo` — для плотности и nested GET; `minimal` — для быстрого CI.
+57 -15
View File
@@ -2,32 +2,74 @@
# Web UI
URL консоли (Compose по умолчанию): [http://127.0.0.1:5000/](http://127.0.0.1:5000/)
Интерактивная консоль: обзор операций контракта Engine, лабораторные токены,
Try-it запросы и управление seed-данными.
UX ящиков совпадает с другими лабораторными симуляторами этого семейства:
URL по умолчанию (Compose): [http://127.0.0.1:5000/](http://127.0.0.1:5000/)
(При `make up-local` — локальный UI-порт из `.env`, например `6080` / `7080`.)
![Консоль](../images/web-ui/console.png)
## Рабочая область
| Область | Назначение |
|---|---|
| Auth | Выдача лабораторных токенов / показ principal |
| API catalog | Обзор операций контракта активного series |
| Coverage | Сводка покрытия pack / handlers |
| Help | Краткие заметки оператора |
| Data | Reseed `minimal` / `demo` |
| Environment | Активный series, runtime-подсказки, hot-swap **Apply pack** |
| Выбор endpoint | Поиск по путям контракта (series pack Engine) |
| Вкладки методов | `GET` / `POST` / `PUT` / `DELETE` для выбранного пути |
| Request body | JSON-пример в форме Engine для create/update/action |
| Params | Плоские path/body-поля для быстрых правок |
| Response | Статус + JSON-дерево последнего ответа |
| History | Недавние Try-it запросы (повтор / восстановление) |
![Ящик Endpoints](../images/web-ui/endpoints.png)
![POST /vms с телом в форме Engine](../images/web-ui/request-body.png)
![Параметры запроса](../images/web-ui/request-params.png)
Тела запросов соответствуют соглашению Engine (root-wrapper сущности или
`action`). В примерах — вложенные ссылки (`cluster`, `template`, CPU topology,
storage domains) под seed-инвентарь лаборатории, а не однополевой stub.
![History](../images/web-ui/history.png)
## Ящики (drawers)
| Ящик | Назначение |
|---|---|
| Authentication | SSO password grant / вставка Bearer-токена |
| API catalog | Обзор series packs; **Apply as runtime** — hot-swap |
| Help → Compatibility | Сводка declared / implemented / verified |
| Data | Reseed `minimal` / `small` / `large` / `big` |
| Environment | Runtime series + обзор инвентаря datacenter |
![Authentication](../images/web-ui/authentication.png)
Лабораторные учётки: `admin@internal`, `ops@internal`, `developer@internal`,
`demo@internal` / `secret`. Scope: `ovirt-app-api`.
![API catalog](../images/web-ui/api-catalog.png)
![Help / compatibility](../images/web-ui/help-compatibility.png)
![Пресеты Data](../images/web-ui/data.png)
![Environment](../images/web-ui/environment.png)
## Hot-swap series
Из Environment (или UI API):
Из **API catalog****Apply as runtime** (или UI API):
- `POST /ui/api/ovirt/contracts/activate` с `{"series":"4.4"}`
- `POST /ui/api/contract/apply?major=N`
Перемонтирует in-memory контрактные маршруты без пересборки образа. Рестарт
процесса возвращает cold-start значение `OVIRT_SERIES`. См.
[Версии API](api-versions.md).
процесса возвращает cold-start `OVIRT_SERIES`. См. [Версии API](api-versions.md).
Брендинг: oVirt blue `#0076B6` и charcoal `#1D2226`.
## Заметки
UI обращается к тому же процессу симулятора, что и Engine API; отличается только
опубликованный listener ([ports.md](ports.md)). Схема OpenAPI:
[http://127.0.0.1:5000/docs](http://127.0.0.1:5000/docs) (также на порту Engine).
- Брендинг: oVirt blue `#0076B6` и charcoal `#1D2226`.
- UI ходит в тот же процесс симулятора, что и Engine API; отличается только
опубликованный listener ([порты](ports.md)).
- OpenAPI: [http://127.0.0.1:5000/docs](http://127.0.0.1:5000/docs)
(также на HTTPS-порту Engine).
+23 -11
View File
@@ -4,12 +4,16 @@
| Profile | How to load | Contents |
|---|---|---|
| `minimal` | Simulator startup (if DB is not already `demo`) / `make seed` / `python -m app.ovirt.seed_cli --profile minimal` / Helm seed Job | 1 datacenter, 1 cluster, 1 host, Blank template, 4 users, small inventory sample |
| `demo` | `make seed-demo` / UI Data drawer / Helm `seed.profile=demo` / `--profile demo` | ~1000 VMs, multi-host DC, networks, storage domains, disks, nested samples |
| `minimal` | Startup (if DB is not a sized demo) / `make seed` / `--profile minimal` | 1 DC, 1 cluster, 1 host, Blank template, 4 users |
| `small` | `make seed-small` / DATA → **Load small** / `--profile small` | **3 hosts · 50 VMs** · 1 DC · 1 cluster · 2 networks · 2 SD |
| `large` | `make seed-large` / DATA → **Load large** / `--profile large` | **10 hosts · 1000 VMs** · 2 DC · 2 clusters · proportional inventory |
| `big` | `make seed-big` / DATA → **Load big** / `--profile big` | **30 hosts · 2000 VMs** · 3 DC · 6 clusters · denser tags/events/jobs |
| `demo` | `make seed-demo` (alias) / `--profile demo` | Same as **`large`** (legacy name) |
On Compose, the FastAPI lifespan loads **`minimal`** automatically when the DB
is empty or not marked as `demo`. Use `make seed-demo` (or the UI Data drawer)
for the large profile. Helm can also run a seed Job (`seed.enabled`).
Sized demos scale datacenters, clusters, hosts, VMs, networks, storage domains,
templates, tags, events, jobs, and nested samples together. On Compose, lifespan
keeps any of `small` / `large` / `big` / `demo` across restarts (does not wipe to
minimal).
Password for all users: **`secret`**. Domain: **`internal`**.
@@ -20,22 +24,30 @@ Principals: `admin@internal`, `ops@internal`, `developer@internal`,
```bash
make seed
make seed-demo
make seed-small
make seed-large # or: make seed-demo
make seed-big
# equivalent
docker compose run --rm --entrypoint python simulator \
-m app.ovirt.seed_cli --profile demo
-m app.ovirt.seed_cli --profile large
```
## UI
Open the **DATA** drawer → **Load small** / **Load large** / **Load big**, or
**Reset to minimal**.
API: `POST /ui/api/demo/load?size=small|large|big`
## Helm
```yaml
seed:
enabled: true
profile: demo # or minimal
profile: large # minimal | small | large | big | demo
```
## Behaviour
Both profiles **truncate** oVirt lab tables then reload. Prefer `demo` for
density and nested GET probes; `minimal` for fast CI.
All profiles **truncate** oVirt lab tables then reload. Prefer `large`/`big` for
density; `minimal` / `small` for fast CI and light labs.
+56 -13
View File
@@ -2,22 +2,63 @@
# Web UI
Console URL (Compose default): [http://127.0.0.1:5000/](http://127.0.0.1:5000/)
Interactive console for browsing Engine contract operations, issuing lab tokens,
sending Try-it requests, and managing seed data.
Drawer UX matches the other laboratory simulators in this family:
Compose default URL: [http://127.0.0.1:5000/](http://127.0.0.1:5000/)
(With `make up-local`, use the local UI port from your `.env`, e.g. `6080` / `7080`.)
![Console](images/web-ui/console.png)
## Workspace
| Area | Purpose |
|---|---|
| Auth | Issue lab tokens / show principal |
| API catalog | Browse contract operations for the active series |
| Coverage | Pack / handler coverage summary |
| Help | Short operator notes |
| Data | Reseed `minimal` / `demo` |
| Environment | Active series, runtime hints, **Apply pack** hot-swap |
| Endpoint picker | Searchable catalog of contract paths (Engine series pack) |
| Method tabs | `GET` / `POST` / `PUT` / `DELETE` for the selected path |
| Request body | Engine-shaped JSON sample for create/update/action |
| Params | Flattened path + body fields for quick edits |
| Response | Status + JSON tree for the last call |
| History | Recent Try-it requests (replay / restore) |
![Endpoints drawer](images/web-ui/endpoints.png)
![POST /vms with Engine-shaped body](images/web-ui/request-body.png)
![Request parameters](images/web-ui/request-params.png)
Request bodies follow the real Engine convention (root-wrapped entity or
`action`). Samples include nested refs (`cluster`, `template`, CPU topology,
storage domains) aligned with the seeded lab inventory — not a one-field stub.
![History](images/web-ui/history.png)
## Drawers
| Drawer | Purpose |
|---|---|
| Authentication | Engine SSO password grant / paste Bearer token |
| API catalog | Browse series packs; **Apply as runtime** hot-swap |
| Help → Compatibility | Declared / implemented / verified surface summary |
| Data | Reseed `minimal` / `small` / `large` / `big` |
| Environment | Runtime series + datacenter inventory overview |
![Authentication](images/web-ui/authentication.png)
Default lab principals: `admin@internal`, `ops@internal`, `developer@internal`,
`demo@internal` / `secret`. Scope: `ovirt-app-api`.
![API catalog](images/web-ui/api-catalog.png)
![Help / compatibility](images/web-ui/help-compatibility.png)
![Data presets](images/web-ui/data.png)
![Environment](images/web-ui/environment.png)
## Series hot-swap
From Environment (or UI API):
From **API catalog****Apply as runtime** (or UI API):
- `POST /ui/api/ovirt/contracts/activate` with `{"series":"4.4"}`
- `POST /ui/api/contract/apply?major=N`
@@ -26,8 +67,10 @@ This remounts the in-memory contract routes without rebuilding the image. A
process restart restores the cold-start `OVIRT_SERIES` value. See
[API versions](api-versions.md).
Branding uses oVirt blue `#0076B6` and charcoal `#1D2226`.
## Notes
The UI talks to the same simulator process as the Engine API; only the published
listener differs ([ports.md](ports.md)). OpenAPI schema:
[http://127.0.0.1:5000/docs](http://127.0.0.1:5000/docs) (also on Engine port).
- Branding uses oVirt blue `#0076B6` and charcoal `#1D2226`.
- The UI talks to the same simulator process as the Engine API; only the
published listener differs ([ports.md](ports.md)).
- OpenAPI schema: [http://127.0.0.1:5000/docs](http://127.0.0.1:5000/docs)
(also available on the Engine HTTPS port).