Skip to main content

zBoxApi

zPodFactory zBox Api

Features

  • DNS Management: Manage DNS records in /etc/hosts with automatic dnsmasq integration
  • VLAN Management: Manage VLAN interfaces with automatic network configuration

Installation

Complete the following steps to set up zBox Api:

  1. Install uv

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Reload your profile so ~/.local/bin is on the PATH
    source ~/.zshrc
    
  2. Install zBoxApi:

    uv tool install zboxapi
    

    zBoxApi requires Python 3.14. Debian ships an older interpreter, so install with uv, which downloads a managed Python 3.14 on its own. pipx install zboxapi only works where a 3.14 interpreter is already on the PATH.

  3. Set up and start zboxapi.service

    cp zboxapi.service /etc/systemd/system
    systemctl daemon-reload
    systemctl enable zboxapi.service
    systemctl start zboxapi.service
    

    Note: The service runs on 127.0.0.1:8000 and requires root privileges for network configuration operations.

Configuration

VLAN Management

For VLAN management functionality, create a configuration file at /etc/zboxapi.conf:

[DEFAULT]
# Base interface name for VLAN management
interface = eth1

# MTU setting for VLAN interfaces
mtu = 1700

# System default VLANs that cannot be modified (comma-separated)
system_vlans_default = 10,20,30

# System zPod VLANs that cannot be modified (comma-separated)
system_vlans_zpod = 64,128,192

See DOC_VLAN.md for detailed documentation on VLAN management features.

API Usage

Authentication

All API endpoints require authentication using the access_token header. The API key is the zPod password which is also the root password of the zbox VM. The password is automatically retrieved from VMware tools:

curl -H "access_token: your_zpod_password" http://127.0.0.1:8000/dns

Note: The service runs on 127.0.0.1:8000 and requires root privileges for network configuration operations.

DNS Management

Manage DNS records in /etc/hosts:

# Add DNS record
curl -X POST "http://127.0.0.1:8000/dns" \
     -H "access_token: your_zpod_password" \
     -H "Content-Type: application/json" \
     -d '{"ip": "192.168.1.100", "hostname": "example.com"}'

# List all DNS records
curl -X GET "http://127.0.0.1:8000/dns" \
     -H "access_token: your_zpod_password"

For complete DNS management documentation, see DOC_DNS.md.

VLAN Management

Manage VLAN interfaces:

# Create VLAN interface
curl -X POST "http://127.0.0.1:8000/vlan" \
     -H "access_token: your_zpod_password" \
     -H "Content-Type: application/json" \
     -d '{"vlan": 2000, "gateway": "192.168.42.129/25"}'

# List all VLAN interfaces
curl -X GET "http://127.0.0.1:8000/vlan" \
     -H "access_token: your_zpod_password"

For complete VLAN management documentation, see DOC_VLAN.md.

Development

The project is managed with uv. Clone the repository, then:

uv sync                 # create .venv with the project and dev dependencies
uv run pytest           # run the unit tests (no root, /etc or network access needed)
uv run pytest --cov     # same, with a coverage report
uv run ruff check src tests && uv run ruff format --check src tests

A justfile wraps the same commands (just test, just lint, just format).

Releasing

Every change gets a line under [Unreleased] in CHANGELOG.md. A release is one command:

python3 tools/release.py 0.2.0 --push      # or: just release 0.2.0

It turns [Unreleased] into a dated [0.2.0] section, bumps pyproject.toml and uv.lock, runs the tests, commits, tags v0.2.0 and pushes. The tag then runs .github/workflows/release.yml, which publishes the changelog section as the GitHub release note, builds the package with uv build, publishes it to PyPI with uv publish and attaches the wheel and sdist to the release. See tools/README.md for the details, including the one-time PyPI setup (an API token secret or trusted publishing).

The test suite exercises every endpoint through FastAPI's TestClient. The hosts file, /etc/zboxapi.conf, /etc/network/interfaces.d/ and the vmtoolsd password lookup are redirected to temporary locations, and the ip, ifup, ifdown and pkill commands are replaced by an in-memory fake, so the tests can run on any machine.

Documentation

  • DOC_DNS.md - Complete guide to DNS management features
  • DOC_VLAN.md - Complete guide to VLAN management features

Metadata

Release files for zboxapi 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zboxapi 0.1.1
File Size Uploaded
zboxapi-0.1.1.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zboxapi 0.1.1
File Interpreter ABI Platform
zboxapi-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.0 kB

Release files / zboxapi-0.1.1.tar.gz

Download URL zboxapi-0.1.1.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d73b30e9319300911d2b8c03744c056e8509d1b43f9aea951649730547220ec3
BLAKE2b-256 checksum
How to use checksums
009dce1062067d52eb8c0924ea50e5e9a248fff8e0c36a90122107961bcd44fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / zboxapi-0.1.1-py3-none-any.whl

Download URL zboxapi-0.1.1-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e99bbaaba35861b25a714cf41df2e3966e5e8d1b31bc08b186d04c7275bc3c0
BLAKE2b-256 checksum
How to use checksums
774bdb8afac857b12d7fad5bf21ce88a89fa1c6cf06bf700b75cb9616f6014ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page