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.
This commit is contained in:
2026-07-18 04:42:11 +03:00
commit f8d3cbdd59
422 changed files with 361335 additions and 0 deletions
+83
View File
@@ -0,0 +1,83 @@
**Language / Язык:** [English](clients.md) | [Русский](ru/clients.md)
# Clients
Use the simulator from common VMware automation stacks: Python, Ansible, Terraform, Pulumi.
## Connection matrix
| Stack | Transport | Notes | Code |
|---|---|---|---|
| REST (curl / SDK) | HTTPS `:443` | `vmware-api-session-id` after Basic session | `examples/python/vsphere_rest_smoke.py`, `vsphere_lifecycle.py` |
| SOAP / VIM | HTTPS `:443/sdk` | pyvmomi / govmomi / Terraform / Pulumi providers | `examples/python/vsphere_soap_smoke.py` |
| Legacy `/rest` | HTTPS `:443` | `{ "value": … }` wrappers | `/rest/vcenter/vm` |
| Terraform | HTTPS `:443` | `hashicorp/vsphere` data sources + optional VM resource | `examples/terraform/vsphere/` |
| Ansible | HTTPS `:443` | REST lifecycle playbook (`uri` module) | `examples/ansible/vsphere_playbook.yml` |
| Pulumi | HTTPS `:443` | REST ComponentResource cookbook | `examples/pulumi/` |
| govc | HTTPS `:443` | `GOVC_URL=https://…` insecure | see below |
| Go / Java / Perl | HTTPS `:443` | Minimal REST cookbooks (Basic-auth session) | `examples/go/`, `examples/java/`, `examples/perl/` |
## Credentials (seed)
| User | Password | Role |
|---|---|---|
| `administrator@vsphere.local` | `VMware1!` | Administrator |
| `readonly@vsphere.local` | `VMware1!` | ReadOnly |
| `operator@vsphere.local` | `VMware1!` | VirtualMachinePowerUser |
| `vmadmin@vsphere.local` | `VMware1!` | VirtualMachineAdministrator |
## Inventory seed
```bash
make seed # large: 10 hosts / 1000 VMs
VSPHERE_PROFILE=demo-cluster make seed
VSPHERE_PROFILE=small make seed
```
## Quick cookbooks
```bash
# All four stacks (Python/Ansible/Terraform/Pulumi-style) inside 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 data sources (plan) + optional CreateVM resource
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
```
Verified against the gateway (`:443`): Python lifecycle, Ansible playbook, Pulumi-style REST, and `terraform plan` (datacenter/cluster/datastore/network/VM data sources) are green. SOAP `CreateVM_Task` is available for the resource path; use a fresh seed if folder names were renamed by probes (`make seed`).
## govc (optional host tool)
```bash
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
```
## pyvmomi smoke
```bash
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
```
Per-language guides: [examples/overview.md](examples/overview.md). Coverage:
[api-coverage.md](api-coverage.md).