Expand lab seed tiers, OpenAPI PARAMS, and console DATA/Params UX.

This commit is contained in:
2026-07-18 08:46:39 +03:00
parent f8d3cbdd59
commit 63cc409424
71 changed files with 38380 additions and 796 deletions
+2 -2
View File
@@ -59,8 +59,8 @@ transfer sessions and HttpNfcLease rows live in `vsphere_transfer_sessions` /
`vsphere_nfc_leases` (`012`); PropertyCollector views/tokens and console
tickets persist in `vsphere_pc_state` / `vsphere_console_tickets` (`013`).
Seed profiles (`small` / `large` / `demo-cluster`) build a deterministic cluster —
default **large** is ~10 hosts / **1000 VMs**.
Seed profiles (`small` / `large` / `big`) build a deterministic cluster —
default **large** is 10 hosts / **1000 VMs** (`big` = 20 / 2000).
## AuthZ
+1 -1
View File
@@ -25,7 +25,7 @@ service. The typed settings model lives in [`app/config.py`](../app/config.py).
| Variable | Default | Meaning |
|---|---|---|
| `SEED_VSPHERE_PROFILE` | `large` | `small` \| `large` \| `demo-cluster` — see [Seed profiles](seed-profiles.md) |
| `SEED_VSPHERE_PROFILE` | `large` | `small` \| `large` \| `big` (`demo-cluster` aliases `big`) — see [Seed profiles](seed-profiles.md) |
| `SEED_VSPHERE_LARGE_HOSTS` | `10` | Host count for the `large` profile |
| `SEED_VSPHERE_LARGE_VMS` | `1000` | VM count for the `large` profile |
+1 -1
View File
@@ -147,7 +147,7 @@ curl -sk -H "vmware-api-session-id: $SID" \
Visit [https://localhost/](https://localhost/) for the interactive
console, endpoint catalog (vSphere majors 69), compatibility view, runtime
contract apply, and demo-cluster controls. See [Web UI](web-ui.md) for
light/dark theme screenshots and the full feature list.
screenshots and the full feature list.
## 8. Try a client library
Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

+2 -2
View File
@@ -60,8 +60,8 @@ transfer content library и строки HttpNfcLease — в `vsphere_transfer_s
`vsphere_nfc_leases` (`012`); views/tokens PropertyCollector и console tickets —
в `vsphere_pc_state` / `vsphere_console_tickets` (`013`).
Профили seed (`small` / `large` / `demo-cluster`) строят детерминированный
кластер — по умолчанию **large** это ~10 hosts / **1000 VMs**.
Профили seed (`small` / `large` / `big`) строят детерминированный
кластер — по умолчанию **large** это 10 hosts / **1000 VMs** (`big` = 20 / 2000).
## AuthZ
+1 -1
View File
@@ -25,7 +25,7 @@ Docker Compose инжектирует многие из них для серви
| Переменная | По умолчанию | Значение |
|---|---|---|
| `SEED_VSPHERE_PROFILE` | `large` | `small` \| `large` \| `demo-cluster` — см. [Профили seed](seed-profiles.md) |
| `SEED_VSPHERE_PROFILE` | `large` | `small` \| `large` \| `big` (`demo-cluster` = `big`) — см. [Профили seed](seed-profiles.md) |
| `SEED_VSPHERE_LARGE_HOSTS` | `10` | Число хостов для профиля `large` |
| `SEED_VSPHERE_LARGE_VMS` | `1000` | Число VM для профиля `large` |
+2 -2
View File
@@ -147,8 +147,8 @@ curl -sk -H "vmware-api-session-id: $SID" \
Откройте [https://localhost/](https://localhost/) — интерактивная
консоль, каталог эндпоинтов (vSphere majors 69), вид совместимости, apply
runtime-контракта и управление demo-cluster. Скриншоты светлой/тёмной темы и
полный список возможностей — [Web UI](web-ui.md).
runtime-контракта и управление demo-cluster. Скриншоты и полный список
возможностей — [Web UI](web-ui.md).
## 8. Попробуйте клиентскую библиотеку
+15 -61
View File
@@ -2,75 +2,29 @@
# Профили seed
Seed **атомарно** заменяет инвентарь vSphere, используя детерминированные
MOID, чтобы лаборатории были воспроизводимыми. Определения находятся в
[`app/vsphere/profiles.py`](../../app/vsphere/profiles.py).
Seed атомарно заменяет инвентарь vSphere с детерминированными MOID.
Определения: [`app/vsphere/profiles.py`](../../app/vsphere/profiles.py).
```bash
make seed # по умолчанию: large (10 хостов / 1000 ВМ)
make seed # по умолчанию: large (10 hosts / 1000 VMs)
VSPHERE_PROFILE=small make seed
VSPHERE_PROFILE=big make seed
VSPHERE_PROFILE=minimal make seed
```
## Профили
| Профиль | Содержимое |
|---|---|
| `small` | 3 хоста ESXi, 2 datastore, 2 сети, один datacenter/cluster/resource-pool и пять именованных ВМ: `web-01`, `web-02`, `db-01`, `app-01`, `jumpbox` (смешанные состояния питания). Используется unit/integration-тестами. |
| `large` (по умолчанию) | Настраиваемое число хостов/ВМ (`SEED_VSPHERE_LARGE_HOSTS` по умолчанию 10, `SEED_VSPHERE_LARGE_VMS` по умолчанию 1000), 4 datastore, 4 сети/portgroup, `VmwareDistributedVirtualSwitch`, папки ВМ production/staging/templates. Первые пять ВМ совпадают по именам с `small` для стабильности кулинарных книг; остальные генерируются (префиксы ролей `web-`, `app-`, `db-`, `cache-`, `batch-`, `jump-`, `ci-`, `mon-`, `log-`, `ml-`). |
| `demo-cluster` | `large` с 20 хостами / 1000 ВМ — набор данных в форме предприятия для демо UI. |
| Профиль | Hosts | VMs | Datastores | Networks | Folders† | Content extras |
|---|---:|---:|---:|---:|---:|---:|
| `minimal` | 3 | 5 | 1 | 1 | 8 | ×1 |
| `small` | 3 | 50 | 2 | 2 | 8 | ×1 |
| `large` (default) | 10 | 1000 | 4 | 4 | 10 | ×2 |
| `big` | 20 | 2000 | 8 | 8 | 14 | ×4 |
Каждый профиль также загружает четыре лабораторные учётные записи, права,
привязанные к ролям (см. [Авторизация](domains/authz.md)), и — там, где
существуют таблицы платформы — стартовую content library, категории/теги
тегирования и метаданные файлов datastore (`seed_platform_extras`).
† Spine + team folders на крупных тирах.
## Примеры
`demo-cluster` = алиас `big`. Reset / unload → `minimal`.
```bash
make seed # large, 10 хостов / 1000 ВМ
VSPHERE_PROFILE=small make seed
VSPHERE_PROFILE=demo-cluster make seed
VSPHERE_PROFILE=large VSPHERE_HOSTS=20 VSPHERE_VMS=5000 make seed
```
## Web UI
Либо запустите CLI seed напрямую с базовыми переменными окружения (например,
из скрипта без `make` или на шаге CI):
```bash
SEED_VSPHERE_PROFILE=small \
docker compose run --rm --entrypoint python simulator -m app.simulation.seed_cli
```
## Форма топологии
Каждый профиль строит один и тот же скелет (папка `Datacenters`
`Datacenter` → подпапки host/vm/datastore/network → один
`ClusterComputeResource` + `ResourcePool`), затем масштабирует хосты,
datastore, portgroup и ВМ. MOID ВМ имеют вид `vm-{100+n}`; MOID хостов —
`host-{10+n}`; каждая ВМ несёт одинаковую форму оборудования, используемую
как REST (`hardware/*`), так и SOAP (`VirtualMachineConfigInfo`) ответами —
NIC, диски, CD-ROM, порядок загрузки и синтетический guest IP/файловая
система.
## Демо-кластер через UI
Интерактивная консоль может загружать демо-набор данных и делать reseed по
запросу:
- `POST /ui/api/demo/load` — загружает `demo-cluster`
- `POST /ui/api/demo/unload` — очищает состояние, созданное через API, затем
загружает `small`
- `GET /ui/api/demo/state`
- `POST /ui/api/vsphere/seed?profile=small|large|demo-cluster` — reseed
любого профиля
Эти вспомогательные эндпоинты UI ориентированы на разработку и сегодня не
имеют отдельной аутентификации. Считайте их только лабораторными органами
управления.
## Reseed в сравнении с состоянием клиентов
Terraform, Pulumi и Ansible могут по-прежнему хранить состояние ресурсов
после reseed (MOID и имена ВМ могут измениться). Выполните refresh или
destroy/recreate внешнего состояния после замены инвентаря PostgreSQL. См.
[Эксплуатация](operations.md) и [Клиенты](clients.md).
Панель **DATA** — три карточки (Small / Large / Big) и **Reset to minimal**.
+47 -6
View File
@@ -2,19 +2,60 @@
# Web UI
Откройте [https://localhost/](https://localhost/) после `make up`
(gateway).
Внутренний порт симулятора — `8080`; лабораторный UI также доступен на этом хосте.
Откройте [https://localhost/](https://localhost/) после `make up` (gateway) или
HTTPS URL, который печатает `make up-local`. Внутренний порт симулятора —
`8080`; лабораторный UI также доступен на этом хосте.
UI — это лабораторная консоль для симулятора **vSphere**, а не замена
vSphere Client. Она поддерживает светлую и тёмную темы, мажоры каталога
**69** (уровни vSphere 7–8.0U2), редактирование запроса/ответа, историю и
применение runtime-контракта.
## Скриншоты
### Главная консоль
![Главная консоль Web UI](../images/web-ui-main.png)
### Каталог API (мажоры 6–9)
![Каталог API с выбранным vSphere 8.0 U2](../images/web-ui-api-catalog.png)
### Браузер endpoint'ов
![Дерево endpoint'ов и пример ответа GET](../images/web-ui-endpoints.png)
### Запрос / ответ
![GET /api/vcenter/vm с фильтрами и ответом 200](../images/web-ui-request.png)
![Редактор параметров запроса](../images/web-ui-request-params.png)
### История
![Панель истории запросов](../images/web-ui-history.png)
### Аутентификация
![Вход в сессию (лабораторные учётные данные)](../images/web-ui-authentication.png)
### Данные / seed
![Demo cluster и управление seed](../images/web-ui-data.png)
### Окружение
![Сводка инвентаря окружения](../images/web-ui-environment.png)
### Справка — совместимость
![Диагностика совместимости (1092 / 1092)](../images/web-ui-help-compatibility.png)
## Возможности
- Дерево endpoint'ов и селектор метода, управляемые выбранным мажором каталога
- Параметры и примеры payload, производные от контракта
- Панель Query parameters (левая колонка) с live-превью query string для GET-фильтров
- Редактор запроса, просмотрщик ответа и история
- Вход в сессию через `POST /api/session` (Basic) → заголовок/cookie
`vmware-api-session-id`
@@ -22,7 +63,7 @@ vSphere Client. Она поддерживает светлую и тёмную
- Предпросмотр запросов в виде curl
- Индикатор покрытия для реализованного реестра REST
- Hot-swap **Apply as runtime** для активного уровня мажора
- Загрузка demo / seed (профили large / demo-cluster)
- Загрузка demo / seed (профили `small` / `large` / `big` в DATA)
- Компактная консоль на `/console.html`
- Ссылка на OpenAPI по адресу `/docs`
@@ -47,8 +88,8 @@ vSphere Client. Она поддерживает светлую и тёмную
| GET | `/ui/api/compatibility?major=N` | Payload покрытия |
| POST | `/ui/api/contract/apply?major=N` | Hot-swap runtime-контракта |
| GET | `/ui/api/demo/state` | Состояние демо-набора данных |
| POST | `/ui/api/demo/load` | Загрузить `demo-cluster` |
| POST | `/ui/api/vsphere/seed?profile=…` | Reseed `small` / `large` / `demo-cluster` |
| POST | `/ui/api/demo/load` | Загрузить `big` (20 hosts / 2000 VMs) |
| POST | `/ui/api/vsphere/seed?profile=…` | Reseed `small` / `large` / `big` |
## Workflow работы с версиями
+24 -31
View File
@@ -9,28 +9,32 @@ so labs are reproducible. Definitions live in
```bash
make seed # default: large (10 hosts / 1000 VMs)
VSPHERE_PROFILE=small make seed
VSPHERE_PROFILE=big make seed
```
## Profiles
| Profile | Contents |
|---|---|
| `small` | 3 ESXi hosts, 2 datastores, 2 networks, one datacenter/cluster/resource-pool, and five named VMs: `web-01`, `web-02`, `db-01`, `app-01`, `jumpbox` (mixed power states). Used by unit/integration tests. |
| `large` (default) | Configurable hosts/VMs (`SEED_VSPHERE_LARGE_HOSTS` default 10, `SEED_VSPHERE_LARGE_VMS` default 1000), 4 datastores, 4 networks/portgroups, a `VmwareDistributedVirtualSwitch`, production/staging/templates VM folders. The first five VMs match the `small` names for cookbook stability; the rest are generated (`web-`, `app-`, `db-`, `cache-`, `batch-`, `jump-`, `ci-`, `mon-`, `log-`, `ml-` role prefixes). |
| `demo-cluster` | `large` with 20 hosts / 1000 VMs — an enterprise-shaped dataset for UI demos. |
| Profile | Hosts | VMs | Datastores | Networks | Folders† | Content extras |
|---|---:|---:|---:|---:|---:|---:|
| `minimal` | 3 | 5 | 1 | 1 | 8 | ×1 |
| `small` | 3 | 50 | 2 | 2 | 8 | ×1 |
| `large` (default) | 10 | 1000 | 4 | 4 | 10 | ×2 |
| `big` | 20 | 2000 | 8 | 8 | 14 | ×4 |
Every profile also seeds the four lab credentials, role-scoped permissions
(see [Authorization](domains/authz.md)), and — where the platform tables
exist — a starter content library, tag categories/tags, and datastore file
metadata (`seed_platform_extras`).
† Spine folders (8) plus scaled team folders for larger tiers.
`demo-cluster` remains an alias of `big`. Reset / unload loads `minimal`.
## Examples
```bash
make seed # large, 10 hosts / 1000 VMs
VSPHERE_PROFILE=small make seed
VSPHERE_PROFILE=demo-cluster make seed
VSPHERE_PROFILE=big make seed
VSPHERE_PROFILE=large VSPHERE_HOSTS=20 VSPHERE_VMS=5000 make seed
# 100% seed ↔ live inventory dump
VSPHERE_PROFILE=big make vsphere-seed-dump
```
Or run the seed CLI directly with the underlying environment variables (for
@@ -43,28 +47,17 @@ SEED_VSPHERE_PROFILE=small \
## Topology shape
Every profile builds the same skeleton (`Datacenters` folder`Datacenter`
host/vm/datastore/network sub-folders → one `ClusterComputeResource` +
`ResourcePool`), then scales hosts, datastores, portgroups, and VMs. VM MOIDs
are `vm-{100+n}`; host MOIDs are `host-{10+n}`; each VM carries the same
hardware shape used by both REST (`hardware/*`) and SOAP (`VirtualMachineConfigInfo`)
responses — NICs, disks, CD-ROM, boot order, and a synthetic guest IP/filesystem.
Every profile builds the same spine (`Datacenters``Datacenter` host/vm/
datastore/network folders → one `ClusterComputeResource` + `ResourcePool`),
then scales hosts, datastores, port groups, and VMs. VM MOIDs are `vm-{100+n}`;
host MOIDs are `host-{10+n}`.
## Demo cluster via UI
## Web UI
The interactive console can load the demo dataset and reseed on demand:
The **DATA** panel exposes three load buttons matching these tiers. Each call
is `POST /ui/api/vsphere/seed?profile=small|large|big` (atomic reseed).
- `POST /ui/api/demo/load` — loads `demo-cluster`
- `POST /ui/api/demo/unload` — wipes API-created state, then loads `small`
- `GET /ui/api/demo/state`
- `POST /ui/api/vsphere/seed?profile=small|large|demo-cluster` — reseed any profile
Legacy endpoints:
These UI helper endpoints are development-oriented and are not separately
authenticated today. Treat them as lab controls only.
## Reseed vs client state
Terraform, Pulumi, and Ansible may still hold resource state after a reseed
(VM MOIDs and names can change). Refresh or destroy/recreate external state
after replacing the PostgreSQL inventory. See [Operations](operations.md) and
[Clients](clients.md).
- `POST /ui/api/demo/load``big`
- `POST /ui/api/demo/unload``small`
+47 -5
View File
@@ -2,24 +2,66 @@
# Web UI
Open [https://localhost/](https://localhost/) after `make up` (gateway).
Internal simulator port is `8080`; the lab UI is also on that host.
Open [https://localhost/](https://localhost/) after `make up` (gateway), or the
HTTPS URL printed by `make up-local`. Internal simulator port is `8080`; the lab
UI is also on that host.
The UI is a laboratory console for the **vSphere** simulator — not a vSphere Client
replacement. It supports light and dark themes, catalog majors **69** (vSphere 78.0U2
floors), request/response editing, history, and runtime contract apply.
## Screenshots
### Main console
![Web UI main console](images/web-ui-main.png)
### API catalog (majors 69)
![API catalog with vSphere 8.0 U2 selected](images/web-ui-api-catalog.png)
### Endpoint browser
![Endpoint tree and sample GET response](images/web-ui-endpoints.png)
### Request / response
![GET /api/vcenter/vm with filters and 200 response](images/web-ui-request.png)
![Request parameters editor](images/web-ui-request-params.png)
### History
![Request history panel](images/web-ui-history.png)
### Authentication
![Session sign-in (lab credentials)](images/web-ui-authentication.png)
### Data / seed
![Demo cluster and seed controls](images/web-ui-data.png)
### Environment
![Environment inventory summary](images/web-ui-environment.png)
### Help — compatibility
![Compatibility diagnostics (1092 / 1092)](images/web-ui-help-compatibility.png)
## Features
- Endpoint tree and method selector driven by the selected catalog major
- Contract-derived parameters and example payloads
- Query parameters pane (left column) with live query-string preview for GET filters
- Request editor, response viewer, and history
- Session login via `POST /api/session` (Basic) → `vmware-api-session-id` header/cookie
- Environment summary (runtime version, hosts, VMs, clusters, datastores, networks)
- Curl / request previews
- Coverage meter for the implemented REST registry
- **Apply as runtime** hot-swap for the active major floor
- Demo / seed load (large / demo-cluster profiles)
- Demo / seed load (`small` / `large` / `big` tiers in DATA)
- Compact console at `/console.html`
- Link to OpenAPI at `/docs`
@@ -44,8 +86,8 @@ After sign-in, Send attaches `vmware-api-session-id` automatically.
| GET | `/ui/api/compatibility?major=N` | Coverage payload |
| POST | `/ui/api/contract/apply?major=N` | Hot-swap runtime contract |
| GET | `/ui/api/demo/state` | Demo dataset state |
| POST | `/ui/api/demo/load` | Load `demo-cluster` |
| POST | `/ui/api/vsphere/seed?profile=…` | Reseed `small` / `large` / `demo-cluster` |
| POST | `/ui/api/demo/load` | Load `big` (20 hosts / 2000 VMs) |
| POST | `/ui/api/vsphere/seed?profile=…` | Reseed `small` / `large` / `big` |
## Version workflow