diff options
| author | Roberto Bertó <463349+robertoberto@users.noreply.github.com> | 2026-05-19 06:05:43 +0000 |
|---|---|---|
| committer | Roberto Bertó <463349+robertoberto@users.noreply.github.com> | 2026-05-19 06:05:43 +0000 |
| commit | bfcaffe9c55b687038eab337a718ea0a43f5e668 (patch) | |
| tree | 10bf25a4d67a3809a185a7a0aef99fbd3da3e535 /README.md | |
| parent | c5a2ae114835791de16c5b982632569377c39bfa (diff) | |
| download | pyvyos-bfcaffe9c55b687038eab337a718ea0a43f5e668.tar.gz pyvyos-bfcaffe9c55b687038eab337a718ea0a43f5e668.zip | |
tests: add live VyOS e2e harness on Proxmox
Adds an opt-in end-to-end harness that runs pyvyos against a real
VyOS HTTPS API on a Proxmox VE host.
tests/pve/ shell-based VM lifecycle on a remote PVE host:
preflight, ensure-template (state-machine over the
VMID with manual-install phase 1 and cloud-init
phase 2), create/start/stop/destroy, run-e2e.
Cloud-init seed ISO is generated on the PVE host
itself; nothing local-side beyond ssh is required.
.env is gitignored; .env.example documents the
full set of variables.
tests/e2e/ pytest suite that exercises the public methods
most likely to regress on a payload change:
show, retrieve_show_config, configure_set /
retrieve_return_values / configure_delete round
trip, and configure_multiple_op batch. Auto-skipped
unless PYVYOS_E2E=1.
The cloud-init template now sets 'service https api rest' before
the API key. Without that flag VyOS only exposes /info; the other
HTTPS routes return 404. README and tests/pve/README document the
requirement, both for cloud-init and for the manual-fallback path.
Also fixes a pre-existing footgun in pyproject.toml: the pytest-env
defaults overwrote VYDEVICE_HOSTNAME from the shell, which made
the e2e tests silently aim at the stale 192.168.56.100 fixture
host. The entries now use the 'D:' (default) prefix so live runs
can override from the environment as expected.
Validated against VyOS rolling 2026.05.18-0045: 4 e2e + 57 unit
tests pass.
This commit does not change pyvyos HTTP payloads, request handling,
or response parsing.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 34 |
1 files changed, 29 insertions, 5 deletions
@@ -24,10 +24,15 @@ Requires **Python 3.11 or newer**. Tested on 3.11, 3.12, and 3.13. Enable the HTTPS API on the VyOS device and create an API key: ```text +set service https api rest set service https api keys id my-key key 'your-secret-key' commit ``` +> The `set service https api rest` line is required. Without it the +> HTTPS service only exposes `/info` and every other endpoint returns +> `404`. See the VyOS docs for the [HTTP API service](https://docs.vyos.io/en/latest/configuration/service/https.html). + Then, from Python: ```python @@ -206,13 +211,22 @@ handed back to the caller. ## VyOS compatibility -Tested against: +Tested live against: + +- VyOS rolling `2026.05.18-0045` (current rolling at release time) -- VyOS 1.4 LTS (stable) -- VyOS 1.5 rolling +The library only depends on the HTTPS API surface, so older 1.4 / 1.5 +builds that expose the same endpoints should work without changes, +but they are not exercised on every release. The live harness under +[`tests/pve/`](tests/pve/) makes it easy to re-run the suite against +any VyOS build you care about. -The library only depends on the HTTPS API surface, so versions that expose -the same endpoints should work without changes. +Required device-side configuration for the live API: + +```text +set service https api rest +set service https api keys id <id> key '<secret>' +``` ## Development @@ -231,6 +245,16 @@ pip install pre-commit pre-commit install ``` +### Live VyOS testing + +The regular test suite is mock-based and does not need a VyOS device. + +For maintainers, this repository ships an opt-in harness under +[`tests/pve/`](tests/pve/) that creates a disposable VyOS VM on a +local Proxmox host and runs `tests/e2e` against the real HTTPS API. +It is not part of the default GitHub Actions workflow. See the +harness README for setup. + ## Contributing Bug reports and pull requests are welcome. Please open an issue first to |
