Files
inecs f8d3cbdd59 Initial commit: VMware vSphere API simulator scaffold.
Add the FastAPI app, PostgreSQL migrations, Docker/Helm packaging, API
contracts, docs, client examples, and the unit/integration/compatibility
test suite for local client and tooling labs without a real vCenter.
2026-07-18 04:42:11 +03:00

3.8 KiB

Language / Язык: English | Русский

Клиенты

Используйте симулятор из распространённых стеков автоматизации VMware: Python, Ansible, Terraform, Pulumi.

Матрица подключений

Стек Транспорт Примечания Код
REST (curl / SDK) HTTPS :443 vmware-api-session-id после Basic-сессии examples/python/vsphere_rest_smoke.py, vsphere_lifecycle.py
SOAP / VIM HTTPS :443/sdk провайдеры pyvmomi / govmomi / Terraform / Pulumi examples/python/vsphere_soap_smoke.py
Legacy /rest HTTPS :443 обёртки { "value": … } /rest/vcenter/vm
Terraform HTTPS :443 источники данных hashicorp/vsphere + опциональный ресурс ВМ examples/terraform/vsphere/
Ansible HTTPS :443 playbook жизненного цикла REST (модуль uri) examples/ansible/vsphere_playbook.yml
Pulumi HTTPS :443 кулинарная книга REST ComponentResource examples/pulumi/
govc HTTPS :443 GOVC_URL=https://… insecure см. ниже
Go / Java / Perl HTTPS :443 минимальные кулинарные книги REST (сессия по Basic-auth) examples/go/, examples/java/, examples/perl/

Учётные данные (seed)

Пользователь Пароль Роль
administrator@vsphere.local VMware1! Administrator
readonly@vsphere.local VMware1! ReadOnly
operator@vsphere.local VMware1! VirtualMachinePowerUser
vmadmin@vsphere.local VMware1! VirtualMachineAdministrator

Seed инвентаря

make seed                          # large: 10 хостов / 1000 ВМ
VSPHERE_PROFILE=demo-cluster make seed
VSPHERE_PROFILE=small make seed

Быстрые кулинарные книги

# Все четыре стека (в стиле Python/Ansible/Terraform/Pulumi) внутри Compose
make client-cookbooks

# Python REST + SOAP CreateVM / NFC
VSPHERE_BASE=https://localhost python examples/python/vsphere_lifecycle.py

# Ansible
ansible-playbook -i examples/ansible/inventory.ini examples/ansible/vsphere_playbook.yml

# Terraform — источники данных hashicorp/vsphere (plan) + опциональный ресурс CreateVM
cd examples/terraform/vsphere
terraform init
TF_VAR_vsphere_server=localhost TF_VAR_create_lab_vm=false terraform plan
TF_VAR_vsphere_server=localhost TF_VAR_create_lab_vm=true terraform apply

# Pulumi REST
cd examples/pulumi && pulumi up

Проверено против gateway (:443): жизненный цикл Python, playbook Ansible, REST в стиле Pulumi и terraform plan (источники данных datacenter/cluster/datastore/network/VM) — всё зелёное. SOAP CreateVM_Task доступен для пути ресурса; используйте свежий seed, если имена папок были переименованы зондами (make seed).

govc (опциональный инструмент на хосте)

export GOVC_URL=https://localhost
export GOVC_USERNAME=administrator@vsphere.local
export GOVC_PASSWORD='VMware1!'
export GOVC_INSECURE=1
govc about
govc ls /
govc find / -type m | head
govc vm.info web-01

Smoke-тест pyvmomi

docker compose run --rm --no-deps -e VSPHERE_BASE=http://simulator:8080 \
  -e TEST_DATABASE_URL=postgresql://vmware:vmware@postgres:5432/vmware_simulator \
  dev pytest tests/compatibility/test_vsphere_pyvmomi.py -q

Руководства по языкам: examples/overview.md. Покрытие: api-coverage.md.