Relocates `cli/meta/{ports,networks/suggest}` to
`cli/contributing/network/{ports,address/suggest}` so port and subnet
allocators live alongside the rest of the contributor-side tooling
(mirror, update, changelog) instead of `meta`. Mirrors the tests
into `tests/unit/cli/contributing/network/` and renames the contract
docs to `docs/contributing/tools/network/{port,address}.md`. Prog
names update from `cli meta ports suggest` / `cli meta networks
suggest` to `cli contributing network ports suggest` / `cli
contributing network address suggest`; the corresponding lint
references and `utils.meta.scan` docstring follow.
Adds a third subcommand: `cli contributing network diagnose`
(stdlib-only DNS / TCP / TLS / PMTU probe against the standard
infrastructure hosts plus interface MTU, `/etc/resolv.conf`,
`/etc/hosts`, proxy env, CA-bundle summaries). Split across `cli.py`
(orchestration), `config.py` (SPOT for hosts / per-distro install
commands), `format.py` (output + subprocess helpers), `tools.py`
(distro-aware auto-install of `iputils-ping` + `iproute2`),
`report.py` (system-info dumps + IPv6-default-route detection), and
`probes.py` (per-host probes). Exposed as `make debug-network`.
Companion `docs/contributing/actions/debugging/network.md` absorbs
the diagnose-tool walkthrough (incl. how to read MTU-induced TLS
handshake timeouts) so the merged page covers DNS / MTU / IPv6 /
connectivity end-to-end.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4.0 KiB
cli contributing network address suggest 🌐
This page documents the contract of the cli contributing network address suggest helper and the rules contributors MUST follow when calling it.
Primary file:
Purpose 🎯
cli contributing network address suggest proposes the next free per-role IPv4 subnet(s) based on the live role tree.
It walks every roles/*/meta/server.yml, collects occupied networks.local.subnet assignments, picks the smallest CIDR prefix that fits the requested client count, and proposes free sub-blocks gap-first then by increment within the established umbrella blocks.
Inputs 🔧
| Flag | Required | Default | Description |
|---|---|---|---|
--clients N |
yes | n/a | Minimum number of usable client IPs the role's subnet MUST hold. |
--count K |
no | 1 |
How many free subnets to return. |
--block <cidr> |
no | n/a | Force suggestions inside a specific umbrella block (e.g. --block 192.168.101.0/24). Default is the union of currently used /24 umbrella blocks for the chosen prefix length. |
Behaviour 🧮
- Translate
--clients Nto the smallest CIDR prefix that fits (≤14 →/28, ≤30 →/27, ≤62 →/26, ≤126 →/25, ≤254 →/24, …). - Walk every
roles/*/meta/server.ymland collect occupied CIDRs fromnetworks.local.subnet. - Within each umbrella
/24block already in use for the chosen prefix length: enumerate all sub-blocks of that prefix length, mark occupied vs. free. - Gap-first: propose the lowest unoccupied sub-block.
- Increment fallback: if all sub-blocks of the active
/24blocks are used, propose the next/24block in the established sequence (currently192.168.101–105for/28,192.168.200–203for/24). - No established sequence: if the requested prefix size has no umbrella block established yet (e.g.
--clients 1000→/22and no/22is in use), exit non-zero with a clear error suggesting that the operator pass--block <cidr>to bootstrap a new umbrella block manually. - For each suggestion, also print the client capacity (
/28 → 14,/24 → 254, …).
Output 📤
- stdout prints one subnet per line.
- stderr prints per-suggestion capacity and a human-readable summary noting which umbrella block(s) were scanned.
Examples 💡
Suggest two free /28 subnets (14 clients each) inside the established umbrella blocks:
cli contributing network address suggest --clients 14 --count 2
Suggest one free /24 subnet (254 clients) bootstrapped inside an explicit umbrella block:
cli contributing network address suggest --clients 254 --block 192.168.200.0/22
Suggest a single /28 subnet (the default --count 1):
cli contributing network address suggest --clients 14
Determinism 🧪
Given the same on-disk role layout and the same arguments, the helper produces identical output. It exits non-zero with a clear error when the requested capacity cannot be satisfied within the configured umbrella block(s).
Integration with cli create role 🧩
When cli create role scaffolds a new role, it prompts for --clients N and calls cli contributing network address suggest --clients N --count 1 to fill in meta/server.yml.networks.local.subnet automatically.
The contributor MAY override the suggestion interactively.
See port.md for the matching ports flow.