๐ Read-only CLI tool to pull IPAM data from NetBox
Project description
๐ nbpull
Read-only CLI tool to pull IPAM data from NetBox.
๐ Safety guarantee: nbpull only reads data from NetBox. No POST / PUT / PATCH / DELETE requests are ever made. The HTTP client is hardcoded to GET-only โ this invariant is enforced by code structure and verified by tests.
โจ Features
- ๐ก Prefixes โ list and filter IPAM prefixes
- ๐ฅ๏ธ IP Addresses โ query IP address allocations
- ๐ท๏ธ VLANs โ browse VLAN assignments
- ๐ VRFs โ inspect VRF instances
- ๐ฆ Batch queries โ check many prefixes at once from a TOML file
- ๐จ Rich table output (default) or JSON (
--format json) - ๐ Filter by status, VRF, tenant, site, tag, or free-text search
- โก Async HTTP with automatic pagination
- ๐ Strict typing (mypy strict mode + Pydantic v2)
๐ฆ Installation
With uv (recommended)
uv tool install nbpull
With pipx
pipx install nbpull
With pip
pip install nbpull
From source
git clone https://github.com/Champion2005/nbpull.git
cd nbpull
make install # uses uv sync
๐ Quick Start
# 1. Run the interactive setup wizard
nbpull setup
# Or configure manually:
export NETBOX_URL=https://netbox.example.com
export NETBOX_TOKEN=your_read_only_token
# Or: cp .env.example .env && edit .env
# 2. Pull data
nbpull prefixes
nbpull prefixes --status active --vrf Production
nbpull ip-addresses --prefix 10.0.0.0/24
nbpull vlans --site DC1
nbpull vrfs --tenant Ops
nbpull batch-prefixes --file my_prefixes.toml --status-only
๐ Commands
| Command | Description |
|---|---|
nbpull setup |
Interactive setup wizard |
nbpull prefixes |
List IPAM prefixes |
nbpull ip-addresses |
List IP addresses |
nbpull vlans |
List VLANs |
nbpull vrfs |
List VRFs |
nbpull batch-prefixes |
Query multiple prefixes from a TOML file |
Common Flags
| Flag | Description |
|---|---|
--status |
Filter by status (active, reserved, deprecated, container) |
--vrf |
Filter by VRF name |
--tenant |
Filter by tenant name |
--site |
Filter by site name |
--tag |
Filter by tag slug |
--search / -s |
Free-text search |
--limit / -l |
Max results (default: 50) |
--format / -f |
Output format: table (default) or json |
--verbose / -v |
Enable debug logging |
See the full command reference for all options.
โ๏ธ Configuration
Set these in .env or as environment variables:
| Variable | Required | Default | Description |
|---|---|---|---|
NETBOX_URL |
โ | โ | NetBox instance URL |
NETBOX_TOKEN |
โ | โ | API token (read-only recommended) |
NETBOX_PAGE_SIZE |
โ | 100 |
Results per API page |
NETBOX_TIMEOUT |
โ | 30 |
Request timeout (seconds) |
NETBOX_VERIFY_SSL |
โ | true |
Verify SSL certificates |
See docs/configuration.md for details on token setup and SSL options.
๐ฆ Batch Queries
Create a TOML file to query multiple prefixes in one run:
prefixes = [
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
]
[filters]
# status = "active"
# vrf = "Production"
nbpull batch-prefixes --file prefixes.toml --status-only
๐ Architecture
src/netbox_data_puller/
โโโ cli.py # Typer commands + filtering
โโโ client.py # Async GET-only NetBox API client
โโโ config.py # Pydantic Settings (.env)
โโโ formatters.py # Rich table renderers
โโโ models/ # Pydantic models per resource
โโโ prefix.py
โโโ ip_address.py
โโโ vlan.py
โโโ vrf.py
See docs/architecture.md for a full breakdown.
๐ ๏ธ Development
Prerequisites
- Python 3.13+
- uv โ fast Python package manager
Setup
git clone https://github.com/Champion2005/nbpull.git
cd nbpull
make install # Install dependencies
Commands
make all # format โ lint โ typecheck โ test
make test # unit tests (no network)
make lint # ruff linter
make format # auto-format with ruff
make typecheck # mypy strict mode
make test-integration # hits real NetBox API
Running Tests
Unit tests use mocked HTTP responses and require no network access:
make test
Integration tests require NETBOX_URL and NETBOX_TOKEN:
make test-integration
๐ค Contributing
Contributions are welcome! Please read CONTRIBUTING.md before opening a PR.
๐ Changelog
See CHANGELOG.md for a history of changes.
๐ License
This project is licensed under the GNU General Public License v3.0 โ see the LICENSE file for details.
๐ Acknowledgements
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nbpull-0.2.0.tar.gz.
File metadata
- Download URL: nbpull-0.2.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b14db4c4b476955bb4766f14a54a2c702bc1713a84d7eb128b611e851142ca85
|
|
| MD5 |
3c9473c35ab7d119c6d24ae5a3dfbbce
|
|
| BLAKE2b-256 |
a9abf627fe2ba7ae95c07cab2b01f3f1b716ca28e93c4f0e051a47fb37dfd870
|
Provenance
The following attestation bundles were made for nbpull-0.2.0.tar.gz:
Publisher:
publish.yml on Champion2005/nbpull
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nbpull-0.2.0.tar.gz -
Subject digest:
b14db4c4b476955bb4766f14a54a2c702bc1713a84d7eb128b611e851142ca85 - Sigstore transparency entry: 1009806290
- Sigstore integration time:
-
Permalink:
Champion2005/nbpull@322b3f0006755ed928177bf10cd6e3cf4c4bc7d5 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Champion2005
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@322b3f0006755ed928177bf10cd6e3cf4c4bc7d5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file nbpull-0.2.0-py3-none-any.whl.
File metadata
- Download URL: nbpull-0.2.0-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c1e517d45629c7247f44d24851429e45b26c505ddd06cfe8be01d66cbe7c28c
|
|
| MD5 |
d2b2b08600fcad565439e07674a62bb9
|
|
| BLAKE2b-256 |
f521d1abd5292f363134b71cd73cbb98aea438031f9294ab96cbb9709f01e9e1
|
Provenance
The following attestation bundles were made for nbpull-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on Champion2005/nbpull
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nbpull-0.2.0-py3-none-any.whl -
Subject digest:
1c1e517d45629c7247f44d24851429e45b26c505ddd06cfe8be01d66cbe7c28c - Sigstore transparency entry: 1009806309
- Sigstore integration time:
-
Permalink:
Champion2005/nbpull@322b3f0006755ed928177bf10cd6e3cf4c4bc7d5 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Champion2005
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@322b3f0006755ed928177bf10cd6e3cf4c4bc7d5 -
Trigger Event:
release
-
Statement type: