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 pipx

    # Install and configure pipx
    apt update
    apt install -y pipx
    pipx ensurepath
    
    # Reload your profile
    source ~/.zshrc
    
  2. Install zBoxApi:

    pipx install zboxapi
    

    Or with uv, which also fetches a suitable Python if needed:

    uv tool install zboxapi
    

    zBoxApi supports Python 3.10 through 3.14.

  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.0

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.0
File Size Uploaded
zboxapi-0.1.0.tar.gz 10.0 kB Details

Built distribution (wheel)

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

Total release size: 21.7 kB

Release files / zboxapi-0.1.0.tar.gz

Download URL zboxapi-0.1.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5b1ef7c70747e84fbcb5c0c272fdd63020d3214aecc421801aedae514659b9dd
BLAKE2b-256 checksum
How to use checksums
ecb16df16fd742bc6f12e5c3d48acf99ecd8162873cc652c56defb3f5e7c6b1d
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.0-py3-none-any.whl

Download URL zboxapi-0.1.0-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
434b3b2f27231f5c39bd6a3cdc7b7261dded62c5c8d3b14395d6f07b3fff58d2
BLAKE2b-256 checksum
How to use checksums
a8f6314d5fa70937e80f748263652cbf5c66b24701ede801455fd0c045cd8484
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

0.1.1

2 release files

This release

0.1.0 This release

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