Initial commit: stateful OpenStack API laboratory simulator.
Ship Keystone auth, multi-service handlers (Yoga→Dalmatian), Compose/Helm packaging, API contract packs, and pytest/Pulumi coverage labs.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
**Language / Язык:** [English](ansible.md) | [Русский](../ru/examples/ansible.md)
|
||||
|
||||
# Ansible (openstack.cloud)
|
||||
|
||||
## Cookbook (single stack)
|
||||
|
||||
[`examples/ansible/playbook.yml`](../../examples/ansible/playbook.yml) uses
|
||||
`ansible.builtin.uri` against Keystone/Nova/Neutron/Glance — no Galaxy collections
|
||||
required. Good for a minimal “create server + metadata + cleanup” walkthrough.
|
||||
|
||||
```bash
|
||||
make up && make seed-demo
|
||||
cd examples/ansible
|
||||
ansible-playbook -i inventory.ini playbook.yml
|
||||
```
|
||||
|
||||
Auth: `http://127.0.0.1:5000/v3`, user `admin`, password `secret`, project `demo`.
|
||||
|
||||
API coverage integration suites now live under [`pulumi-tests/`](../../pulumi-tests/)
|
||||
(Pulumi / `pulumi_openstack`). See [hypervisor-lab.md](../hypervisor-lab.md).
|
||||
@@ -0,0 +1,19 @@
|
||||
**Language / Язык:** [English](openstack-cli.md) | [Русский](../ru/examples/openstack-cli.md)
|
||||
|
||||
# OpenStack CLI
|
||||
|
||||
```bash
|
||||
export OS_AUTH_URL=http://127.0.0.1:5000/v3
|
||||
export OS_USERNAME=admin
|
||||
export OS_PASSWORD=secret
|
||||
export OS_PROJECT_NAME=demo
|
||||
export OS_USER_DOMAIN_NAME=Default
|
||||
export OS_PROJECT_DOMAIN_NAME=Default
|
||||
export OS_IDENTITY_API_VERSION=3
|
||||
|
||||
openstack token issue
|
||||
openstack server list
|
||||
openstack network list
|
||||
openstack volume list
|
||||
openstack stack list
|
||||
```
|
||||
@@ -0,0 +1,53 @@
|
||||
**Language / Язык:** [English](overview.md) | [Русский](../ru/examples/overview.md)
|
||||
|
||||
# Client examples overview
|
||||
|
||||
Runnable scripts live under [`examples/`](../../examples/).
|
||||
Pulumi API coverage lab lives under [`pulumi-tests/`](../../pulumi-tests/).
|
||||
|
||||
## Quick reference
|
||||
|
||||
| Path | Tool | Purpose |
|
||||
|---|---|---|
|
||||
| `examples/python/openstacksdk_cookbook.py` | openstacksdk | net + server + volume lifecycle |
|
||||
| `examples/ansible/playbook.yml` | Ansible `uri` | minimal Keystone/Nova/Neutron |
|
||||
| `examples/terraform/main.tf` | Terraform | `openstack_compute_instance_v2` + volume |
|
||||
| `examples/pulumi/` | Pulumi | `pulumi_openstack` Instance + Network |
|
||||
| `examples/run_iac_stack.sh` | all four | sequential smoke of cookbooks |
|
||||
| `pulumi-tests/` | Pulumi | every pack operation × yoga→dalmatian + HTML report |
|
||||
|
||||
## Auth quick reference
|
||||
|
||||
1. `POST /v3/auth/tokens` → `X-Subject-Token`
|
||||
2. Call services with `X-Auth-Token` on the correct [port](../ports.md)
|
||||
|
||||
Default lab: `admin` / `secret`, project `demo`, domain `Default`.
|
||||
|
||||
## Cookbooks
|
||||
|
||||
- [Python (requests)](python-requests.md)
|
||||
- [Python (openstacksdk)](python-openstacksdk.md)
|
||||
- [Ansible](ansible.md)
|
||||
- [Terraform](terraform.md)
|
||||
- [Pulumi](pulumi.md)
|
||||
- [CLI](openstack-cli.md)
|
||||
- [Troubleshooting](troubleshooting-clients.md)
|
||||
|
||||
## API coverage lab (Pulumi)
|
||||
|
||||
Full guide: [hypervisor-lab.md](../hypervisor-lab.md)
|
||||
|
||||
```bash
|
||||
cd pulumi-tests
|
||||
make up
|
||||
make test-pulumi-smoke
|
||||
make test-pulumi
|
||||
open reports/pulumi-report.html
|
||||
```
|
||||
|
||||
Probe scripts (simulator conformance helpers):
|
||||
|
||||
| Script | Purpose |
|
||||
|---|---|
|
||||
| `examples/python/openstack_smoke.py` | Multi-port GET smoke |
|
||||
| `examples/python/openstack_surface_probe.py` | Pack operation probe (also used by Pulumi lab) |
|
||||
@@ -0,0 +1,30 @@
|
||||
**Language / Язык:** [English](pulumi.md) | [Русский](../ru/examples/pulumi.md)
|
||||
|
||||
# Pulumi (pulumi_openstack)
|
||||
|
||||
## Cookbook (single stack)
|
||||
|
||||
[`examples/pulumi/`](../../examples/pulumi/) — `pulumi_openstack` Instance,
|
||||
Network, Subnet against the simulator.
|
||||
|
||||
```bash
|
||||
make up && make seed-demo
|
||||
cd examples/pulumi
|
||||
pulumi stack init dev --secrets-provider passphrase
|
||||
export PULUMI_CONFIG_PASSPHRASE=lab
|
||||
pulumi up
|
||||
pulumi destroy
|
||||
```
|
||||
|
||||
## Coverage lab (`pulumi-tests`)
|
||||
|
||||
[`pulumi-tests/`](../../pulumi-tests/) runs `pulumi_openstack` coverage stacks for
|
||||
every series, asserts non-empty exports, then HTTP-probes pack operations with
|
||||
non-empty body checks.
|
||||
|
||||
```bash
|
||||
make pulumi-tests
|
||||
open pulumi-tests/reports/pulumi-report.html
|
||||
```
|
||||
|
||||
See [hypervisor-lab.md](../hypervisor-lab.md).
|
||||
@@ -0,0 +1,24 @@
|
||||
**Language / Язык:** [English](python-openstacksdk.md) | [Русский](../ru/examples/python-openstacksdk.md)
|
||||
|
||||
# Python + openstacksdk
|
||||
|
||||
```python
|
||||
import openstack
|
||||
|
||||
conn = openstack.connect(
|
||||
auth_url="http://127.0.0.1:5000/v3",
|
||||
project_name="demo",
|
||||
username="admin",
|
||||
password="secret",
|
||||
user_domain_name="Default",
|
||||
project_domain_name="Default",
|
||||
)
|
||||
|
||||
for server in conn.compute.servers():
|
||||
print(server.name, server.status)
|
||||
for network in conn.network.networks():
|
||||
print(network.name)
|
||||
```
|
||||
|
||||
Ensure the service catalog ports are reachable (Compose gateway or Helm
|
||||
port-forward). See [clients.md](../clients.md).
|
||||
@@ -0,0 +1,35 @@
|
||||
**Language / Язык:** [English](python-requests.md) | [Русский](../ru/examples/python-requests.md)
|
||||
|
||||
# Python + requests
|
||||
|
||||
```python
|
||||
import requests
|
||||
|
||||
AUTH = "http://127.0.0.1:5000/v3/auth/tokens"
|
||||
r = requests.post(
|
||||
AUTH,
|
||||
json={
|
||||
"auth": {
|
||||
"identity": {
|
||||
"methods": ["password"],
|
||||
"password": {
|
||||
"user": {
|
||||
"name": "admin",
|
||||
"domain": {"name": "Default"},
|
||||
"password": "secret",
|
||||
}
|
||||
},
|
||||
},
|
||||
"scope": {
|
||||
"project": {"name": "demo", "domain": {"name": "Default"}}
|
||||
},
|
||||
}
|
||||
},
|
||||
)
|
||||
r.raise_for_status()
|
||||
token = r.headers["X-Subject-Token"]
|
||||
headers = {"X-Auth-Token": token}
|
||||
|
||||
servers = requests.get("http://127.0.0.1:8774/v2.1/servers", headers=headers)
|
||||
print(servers.status_code, len(servers.json().get("servers", [])))
|
||||
```
|
||||
@@ -0,0 +1,23 @@
|
||||
**Language / Язык:** [English](terraform.md) | [Русский](../ru/examples/terraform.md)
|
||||
|
||||
# Terraform (openstack provider)
|
||||
|
||||
## Cookbook (single stack)
|
||||
|
||||
[`examples/terraform/main.tf`](../../examples/terraform/main.tf) uses
|
||||
**`terraform-provider-openstack/openstack`** (`openstack_compute_instance_v2`,
|
||||
network, volume attach) against the local gateway ports.
|
||||
|
||||
```bash
|
||||
make up && make seed-demo
|
||||
cd examples/terraform
|
||||
terraform init
|
||||
terraform apply
|
||||
terraform destroy
|
||||
```
|
||||
|
||||
Defaults: `auth_url = http://127.0.0.1:5000/v3`, user `admin`, project `demo`,
|
||||
`insecure = true` (lab HTTP gateway).
|
||||
|
||||
API coverage integration suites now live under [`pulumi-tests/`](../../pulumi-tests/)
|
||||
(Pulumi / `pulumi_openstack`). See [hypervisor-lab.md](../hypervisor-lab.md).
|
||||
@@ -0,0 +1,26 @@
|
||||
**Language / Язык:** [English](troubleshooting-clients.md) | [Русский](../ru/examples/troubleshooting-clients.md)
|
||||
|
||||
# Client troubleshooting
|
||||
|
||||
## Catalog points at unreachable hosts
|
||||
|
||||
The seed catalog uses `host.docker.internal` or compose service hostnames in
|
||||
some setups. Override endpoints or use the gateway host you actually expose
|
||||
(`127.0.0.1` with port-forward).
|
||||
|
||||
## SSL errors against Ingress
|
||||
|
||||
Lab staging issuers are untrusted — use `curl -k` / `OS_INSECURE=true` only in labs.
|
||||
|
||||
## Empty server list
|
||||
|
||||
Wrong project scope, or demo not loaded. Check:
|
||||
|
||||
```bash
|
||||
openstack project list
|
||||
make seed-demo
|
||||
```
|
||||
|
||||
## Microversion rejected
|
||||
|
||||
Lower the requested compute microversion or clear Web UI overrides.
|
||||
Reference in New Issue
Block a user