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.
- π‘ 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)
With uv (recommended)
uv tool install nbpullWith pipx
pipx install nbpullpip install nbpullgit clone https://github.com/Champion2005/nbpull.git
cd nbpull
make install # uses uv sync# 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| 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 |
| 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.
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.
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-onlysrc/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.
- Python 3.13+
- uv β fast Python package manager
git clone https://github.com/Champion2005/nbpull.git
cd nbpull
make install # Install dependenciesmake 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 APIUnit tests use mocked HTTP responses and require no network access:
make testIntegration tests require NETBOX_URL and NETBOX_TOKEN:
make test-integrationContributions are welcome! Please read CONTRIBUTING.md before opening a PR.
See CHANGELOG.md for a history of changes.
This project is licensed under the GNU General Public License v3.0 β see the LICENSE file for details.