# NetBox imports — v1 scope

This directory contains the NetBox import scripts required for v1 (IPv4-only)
deployment. Each script is idempotent; re-running is safe.

## Scripts

### `ipv4-prefixes-import.py`

Adds the IPv4 prefixes required for v1:

- Metal `/22` (10.12.8.0/22)
- Provider `/22` (10.12.4.0/22) with Provider IP Ranges (FIP pool + API VIPs)
- LBaaS Mgmt `/22` (10.12.32.0/22)
- IPv4 tenant pool `/16` (default 10.20.0.0/16; configurable via
  `TENANT_POOL_CIDR` env var)

Run order: first.

```
NETBOX_URL=https://netbox.baldurkeep.com NETBOX_TOKEN=<token> \
    python3 ipv4-prefixes-import.py
```

### `ipv6-mark-reserved.py`

Marks existing IPv6 prefixes scoped to VR0 DC0 as **reservation status** per
**D-015** (v1/v2 fork). The IPv6 entries from earlier session work are NOT
deleted — they're preserved to document v2 design intent without implying
they are active during v1.

Run order: second (after IPv4 prefixes are in place).

```
NETBOX_URL=https://netbox.baldurkeep.com NETBOX_TOKEN=<token> \
    python3 ipv6-mark-reserved.py
```

Use `--dry-run` to preview without changes. Use `--revert` only when v2
work begins (sets IPv6 prefixes back to active).

## Deferred to v2

### VLAN imports (`vlans-import.py` — removed)

Per the v1/v2 fork session Q2, additional VR0 DC0-VLANs group entries
(VIDs 50, 200, 220, 221, 222, 230, 260, 270) are **not imported in v1**.

Rationale: MAAS currently uses untagged-per-fabric on the existing network
layout. Modeling additional VLAN entries in NetBox without corresponding
network-side VLAN tagging would be misleading documentation. The VID 240
(OS-Provider) entry imported during prior session work is sufficient for v1
since it pairs with the Provider /22 prefix.

When v2 work begins, the VLAN import script will be re-introduced under
the v2 design with VLAN tagging actually in play.

### IPv6 active prefixes

The IPv6 prefix entries previously imported (Provider /60 + sub-/64s, Metal
/60, Data /60, Storage /60, Replication /60, LBaaS Mgmt /60, OOB /60) are
**reserved** in NetBox via `ipv6-mark-reserved.py`. They become active
again under the planned `/60 → /64` refactor and full re-import when v2
work begins.

## NetBox version

These scripts assume NetBox 4.x:

- Prefix scope: `scope_type="dcim.site"` + `scope_id=<id>` (not legacy `site=` field)
- Prefix read: `p.scope` (not `p.site`)
- Status field: `"reserved"` / `"active"` as lowercase choice slugs

If your NetBox is older, the scripts will need adjustment.

## Sequence for v1 deploy gate

1. `python3 ipv4-prefixes-import.py` — succeeds; verification block clean
2. `python3 ipv6-mark-reserved.py` — succeeds; all IPv6 prefixes now reserved
3. Bundle drafting can proceed; values traced to NetBox are now authoritative
